-
ORDER not working in SQL query
Worked perfect! Thank you very much
-
ORDER not working in SQL query
Hi all, I'm stuck with setting an ORDER command in an SQL query, could someone please help. I'm trying to order by descending date. Here's what I'm trying: $sql = "SELECT * FROM `videos` ORDER BY `date` DESC WHERE " . ((!@empty($_REQUEST["id"])) ? "`entry` = '" . $_REQUEST["id"] . "'" : "`link` = '" . @$_SERVER["QUERY_STRING"] . "'"); The above creates the following error on the page: Query failed : SELECT * FROM `videos` ORDER BY `date` DESC WHERE `entry` = '44' at line 93 Without putting in an ORDER command, the result displays no problem. However, the oldest entries are at the top. I'm trying to get my results to order with the newest at the top. Could someone please suggest where I am going wrong. Thank you
-
PHP Syntax issue with $_REQUEST["id"] in a query
Hi, I've got it working! Thank you very much for your help
-
PHP Syntax issue with $_REQUEST["id"] in a query
Thanks. Again, I'm not sure if I'm doing this right and its quite hard to explain what I'm trying to do. Please don't worry if it's too much trouble, the code I've got set up for the page is: <?php include("../includes/db_open.php"); $sql = "SELECT *, DATE_FORMAT(`date`, '%D %M %Y') AS `date` FROM `videos_category` WHERE " . ((!@empty($_REQUEST["id"])) ? "`id` = '" . $_REQUEST["id"] . "'" : "`link` = '" . @$_SERVER["QUERY_STRING"] . "'"); $result10 = mysql_query($sql) or die("Query failed : {$sql} at line " . __line__); if (mysql_num_rows($result10) == 0) { header("location: " . $_SERVER["HTTP_REFERER"]); exit; } $row = mysql_fetch_assoc($result10); ?> <?php set_include_path(get_include_path() . ":../includes:../../includes"); include("root.php"); ?> <html> <head> </head> <body> <?php $id = intval($_REQUEST["id"]); $sql = sprintf("SELECT * FROM videos WHERE id = '%s' " , mysql_real_escape_string($id) ); $result4 = mysql_query($sql) or die("Query failed : {$sql} at line " . __line__); $n = 0; while ($row = mysql_fetch_assoc($result4)) { $n++; if (strlen($row["heading"]) > 30) $row["heading"] = substr($row["heading"], 0, 30) . "..."; ?> <div class="youtube_full"> <div class="youtube_video"> <img src="images/round_image_border_1.png" width="18" height="19" alt="Border" class="border_1" /> <img src="images/round_image_border_2.png" width="18" height="19" alt="Border" class="border_2" /> <img src="images/round_image_border_3.png" width="18" height="19" alt="Border" class="border_3" /> <img src="images/round_image_border_4.png" width="18" height="19" alt="Border" class="border_4" /> <?php echo str_replace(array("265", "320"), array("220", "285"), $row["description"])?> </div> <p><?php echo $row["heading"]?></p> </div> <?php if ($n < mysql_num_rows($result4)) { ?> <?php } } ?> <?php echo '<pre>'; print_r($row); echo '</pre>' ?> </body> </html>
-
PHP Syntax issue with $_REQUEST["id"] in a query
Hey, thanks for the help I am, however, still running into a bit of difficulty. I've tried implementing your code above but my videos are still not showing. Is how I've done it below how it should be? <?php $id = intval($_REQUEST["id"]); $sql = sprintf("SELECT * FROM videos WHERE id = '%s' " , mysql_real_escape_string($id) ); $result4 = mysql_query($sql) or die("Query failed : {$sql} at line " . __line__); $n = 0; while ($row = mysql_fetch_assoc($result4)) { $n++; if (strlen($row["heading"]) > 30) $row["heading"] = substr($row["heading"], 0, 30) . "..."; ?> <div class="youtube_full"> <div class="youtube_video"> <img src="images/round_image_border_1.png" width="18" height="19" alt="Border" class="border_1" /> <img src="images/round_image_border_2.png" width="18" height="19" alt="Border" class="border_2" /> <img src="images/round_image_border_3.png" width="18" height="19" alt="Border" class="border_3" /> <img src="images/round_image_border_4.png" width="18" height="19" alt="Border" class="border_4" /> <?php echo str_replace(array("265", "320"), array("220", "285"), $row["description"])?> </div> <p><?php echo $row["heading"]?></p> </div> <?php if ($n < mysql_num_rows($result4)) { ?> <?php } } ?>
-
PHP Syntax issue with $_REQUEST["id"] in a query
Hi all, I'm trying to request an id within an SQL query but just can't figure out the correct syntax. Could someone please suggest where I am going wrong. Here is what I currently have: $sql = "SELECT * FROM `videos` ORDER BY `order` WHERE " . ("`id` = " . $_REQUEST["id"] . ""); Could some please help me identify where I'm going wrong.
-
Help with PHP str_replace please
Thank you very much
-
Help with PHP str_replace please
Hi there, Could someone please help me with this PHP command please... <?php echo str_replace("265", "160", $row["video"])?> This is for a client who is inserting the YouTube embed code into a field that gets updated on the site. The values above basically are saying that to replace 265 with 160 (if that value is found in the code - this refers to the height of the video object). However, I ALSO want it to replace the width value from 320 to 198, but I don't know how to add more than one string replace into the above code. I'm good at using PHP but not creating it in some cases! Could someone please help me with this one. Many thanks.
-
Where to find a smooth fade in/out on hover for a CSS styled navigation bar?
Ah I see, I'll give it a go and see what I can do with it. Thanks a lot
-
Where to find a smooth fade in/out on hover for a CSS styled navigation bar?
Nice! Thanks a lot. But what do you mean by a text indent?
-
Where to find a smooth fade in/out on hover for a CSS styled navigation bar?
Hi everyone! I have created a navigation bar using CSS and I have applied background images to the links within the navigation. I know how to create :hover states for these CSS links, however does anyone know of a smooth transition effect I can use? I presume this will involve a combination of CSS and jQuery or JavaScript? It's important for SEO that I retain the text within the link and that they are not just graphic buttons. Anyone know some good code/suggestions for this please?
-
Overcoming high competition for a new SEO client?
Could you elaborate on what you mean by "long tailed keywords" please.
-
Overcoming high competition for a new SEO client?
Great, thanks for all the suggestions
-
What do when a competitor abuses Google Local Business Map Results?
Great, thank you very much
-
What do when a competitor abuses Google Local Business Map Results?
Hi all, I have a client who is top of Google for his organic listings, yey! However his main local competitor is in 2nd position and to try and in a cheap effort to get above him has completely abused the Google Local Business Map listings in my opinion. He has basically got three different areas in the town that he has weekly clubs at. Two of which are a combined property. He has registered a local business listing to each of these three areas including individual listings for the building that is basically what was two combined flats. He has spammed the listings with keywords. The three listings that show up while subtly different in location - are all the same business and web site. Is this kind of thing allowed? And if not, is there any way I can report it or at least put my case forward?