PHP - Another Hair Tearer Outa!
Hey Guys,
Struggling again with some full text searching etc. I have a MySQL statement in my code but it's not working. Now, it's probably something extremely simple, but I just can't see it. Code: [Select] //Now we search for our search term, in the field the user specified so we know how many pages to link to at the bottom $data = mysql_query("SELECT * , MATCH ('status', 'date', 'species', 'breed', 'sex', 'primary_colour', 'colour', 'distinctive_traits', 'fur_length', 'age', 'desexed', 'microchipped', 'suburb', 'pound_area', 'contact', 'link') AGAINST ('%$find%') AS score FROM animal_info WHERE MATCH ('status', 'date', 'species', 'breed', 'sex', 'primary_colour', 'colour', 'distinctive_traits', 'fur_length', 'age', 'desexed', 'microchipped', 'suburb', 'pound_area', 'contact', 'link') AGAINST ('%$find%') $max"); //Make sure we have some results to pass $result = mysql_query($data) or die("No Results Here"); //And we display the results of the search query as long as there is some while($row = mysql_fetch_array($result)) { //Build the HTML for the results in the table Now, my second question is that I've made a quick template for this, but I'm not sure how to format the "or die()" statement so it looks pretty with the header, footer etc. Code: [Select] $result = mysql_query($data) or die("**SOME HTML FORMATTING IN HERE**"); Any help, once again, would be greatly appreciated! Cheers, Dave Similar TutorialsHello all, Would anyone know how to fix this code to work so that when a user fills out a simple form it update a row in my database? The code below doesn't get the parameters from the form. The $sql = 'UPDATE services SET `Description` = "$description1" WHERE ID=1'; line works perfect only its putting in the $description literally no form parameters?? I have a feeling I need to handle this a different way but other trys with different code were not successful. Using Myphpadmin and mysql 5.1 Thanks in advanced. Code: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php $con = mysql_connect('localhost', 'DATA_BASE', 'test123'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("DATA_BASE", $con); $sql = 'UPDATE services SET `Description` = "$description1" WHERE ID=1'; mysql_query($sql, $con); if($_POST['Submit']){ $description1=$description1=$_POST['description1']; $price1=$_POST['price1']; mysql_error(); header("location:updates.php"); exit; } mysql_close(); ?> <html> <head> <title>Updates Page</title> </head> <body bgcolor="#A55125"> <div align="center"> <form method="post" action="<? echo $PHP_SELF; ?>"> <span class="forms">Description:</span><br /> <textarea name="description1" cols="40" rows="5" > </textarea><br> <span class="forms">Price:<br /> </span> <input name="price1" type="text" id="price1"><br /> <input type="submit" value="Submit" /> </form> </div> </body> </html> MOD EDIT: [code] . . . [/code] tags added. Hi all: I have been going nuts trying to get this to work. I have gone through many attempts based on internet searches and examples that simply do not work. I have files stored in my MySQL db. The files cna be of any type and are being displayed in a listed report. The files are hyperlinked and clickable, but here is the issue: When I click on a file in: http://development.products-and-services.ca/cms/test.php I get: http://development.products-and-services.ca/cms/test2.php?content=DHall_CV_webdev_eng.pdf as a blank page result. The objective is to get a file download alert or to see the file in the browser. Any ideas? |