The code bellow trows me an error on line 11... can anyone help me as to why is do that ? <?php $con = mysql_connect("localhost","asd","das"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("asd", $con); $result = mysql_query('SELECT * FROM `images` WHERE `tags` LIKE '%' . $_GET['tag'] . '%'); while($row = mysql_fetch_array($result)) { echo '<a href='http://mydomain.com/out.php/'.$row['name'].'</a>'; echo "<br/>"; } ?> PHP:
$result = mysql_query("SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%'"); PHP:
thanks nico! after putting that in i get Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/izlik/public_html/tags.php on line 14 and using crimson Editor i already se one on line 14 <?php $con = mysql_connect("localhost","asd","asd"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("das", $con); $result = mysql_query("SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%'"); while($row = mysql_fetch_array($result)) { echo '<a href='http://mydomain.com/out.php/'.$row['name'].'</a>'; echo "<br/>"; } ?> PHP:
now this one poped up up! Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/izlik/public_html/tags.php on line 11 <?php $con = mysql_connect("localhost","asd","asd"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("asd", $con); $result = $result = mysql_query("SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%'"); while($row = mysql_fetch_array($result)) { echo '<a href="http://mydomain/out.php/">' .$row['name'].'</a>'; echo "<br/>"; } ?> PHP:
<?php $con = mysql_connect("localhost","asd","asd") OR die('Could not connect: ' . mysql_error()); mysql_select_db("asd", $con); $result = mysql_query(" SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%' ") OR die(mysql_error()); while($row = mysql_fetch_array($result)) { echo '<a href="http://mydomain/out.php/">' .$row['name'].'</a>'; echo "<br/>\n"; } ?> PHP:
thanks a lot nicko, your just awsome! adding rep for you and thanks a lot! however i have one last question, is it someway to make this easy on the database to load? like let's say that there is a huge ammount of data to load and many people do it at the same time.
$filename = preg_replace('~\.[a-z0-9]+$~i', '.html', $row['name']); echo '<a href="http://mydomain/out.php/' . $filename .'">' .$row['name'].'</a>'; PHP:
thanks again nico i know i promised that was the last question, but i have another problem i just cant get my hand around "need to study more php" as you se in the code bellow i but a limit to 30 images. now i know "limit" has more parameters so that if there is more then 30 images it could make a "next page" avaliable to view the rest of the images. do you think you could help me with this? i know i asked a lot already but if you could help me with this i would love you forever! <?php $con = mysql_connect("localhost","asd","asd") OR die('Could not connect: ' . mysql_error()); mysql_select_db("das", $con); $result = mysql_query(" SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%' ORDER BY views DESC LIMIT 50 ") OR die(mysql_error()); while($row = mysql_fetch_array($result)) { echo '<a href="http://mydomain.net/show.php/' .$row['id'].'_' .$row['name'].'"><img src="http://www.mydomain.net/out.php/t' .$row['id'].'_' .$row['name'].'"></a>'; echo "<br/>\n"; } ?> PHP: