[ vatri @ 19.10.2010. 20:53 ] @
Treba da se preko search-a ucita stranica, tj. prvo se nadje da li postoji trazeni korisnik(njegovo ime je link ka stranici tipa "http://localhost/final1/photo/public/photo.php?id=46") evo koda: Code: if(isset($_POST['submit'])){ // if(preg_match("^/[A-Za-z]+/^", $_POST['name'])){ $name=$_POST['name']; //connect to the database $db=mysql_connect ("localhost", "root", "kojic") or die ('I cannot connect to the database because: ' . mysql_error()); //-select the database to use $mydb=mysql_select_db("widget_corp"); //-query the database table $sql="SELECT id, FirstName, LastName, filename FROM photographs WHERE FirstName LIKE '%" . $name . "%' OR LastName LIKE '%" . $name ."%'"; //-run the query against the mysql query function $result=mysql_query($sql); //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ $FirstName =$row['FirstName']; $LastName=$row['LastName']; $ID=$row['id']; $filename=$row['filename']; //-display the result of the array echo "<ul>\n"; echo "<li>" . "<a href=\"photo.php?id="$ID"\">" .$FirstName . " " . $LastName . "</a></li>\n"; IMAM PROBLEM SA OVOM LINIJOM KODA echo "</ul>"; } } else{ echo "<p>Please enter a search query</p>"; } // } ?> tj. Sta treba da napisem umesto "$ID" da bih dobio trazenu stranicu tj. treba tu da povucem ID slike i dobio bih stranicu Ovako kako je napisano izbacuje gresku : Parse error: parse error, expecting `','' or `';'' Ako napisem npr. id izbaci mi imena ali svaki link vuce na istu sliku... |