SA Rob Posted June 26, 2011 Author Share Posted June 26, 2011 Use belowecho '$q reference: '.$q.'<br />';echo 'Number of records Found using $q reference: '.mysql_num_rows($result).'<br />';echo "<table border='5' cellpadding='3' cellspacing='2' bordercolor='#D6D6D8' font style='font-size:11px' color='#2611A2' face='Calibri'>";echo "<tr>";echo "<th bgcolor='#D3E2FE'>PICTURE</th>";echo "</tr>";while($row = mysql_fetch_array($result)) {if($row['image']=="") { echo "<tr>"; echo "<td>currently no image entered for this record id: ".$row['Record_Nr']." </td>"; echo "</tr>"; }else{ echo "<tr>"; echo "<td><img src='".$row['image']."' alt='' /></td>"; echo "</tr>";}}echo "</table>"; to check if the value for $q has been passed, to use in SQL query.check how many records found that matches $q reference.check if image file has been inserted for that record, and not blank.this should give you and idea what or what is not, passed, searched for and found. Progress is made thank you.When I make the selction then the following text is reflected$q reference: 12Number of records Found using $q reference: 1and should I select the first choice @$q reference :1Number of records Found using $q reference:0This then says to me that it recognises the difference in choice and recognises there is a record found for an image when selecting for reference 12 and 13, but cannot find them to show them.This is perhaps what birbal was refering to in his post or perhaps my atributes inMySQL are incorrectThanks again for your help Link to comment Share on other sites More sharing options...
dsonesuk Posted June 26, 2011 Share Posted June 26, 2011 It looks like you have produced the select dropdown values manually, and so these values may not tie in with the id ref value assigned to specific record, you should produce the option list dynamically using php from records from this database table, and the value will be the id reference.At present 'Record_Nr' 12, could be a reference for KEMPTON PARK GC - 05/01/2011, or any the other club, it does not know, it just lists the record that matches the value you passed from the manually produced dropdown list. while($row = mysql_fetch_array($result)) { echo '<option value="'.$row['Record_Nr'].'">'.$row['club_name'].'</option>'; } This way you will know the value, and club name will match the id/club name values in the database table exactly. Link to comment Share on other sites More sharing options...
SA Rob Posted June 26, 2011 Author Share Posted June 26, 2011 It looks like you have produced the select dropdown values manually, and so these values may not tie in with the id ref value assigned to specific record, you should produce the option list dynamically using php from records from this database table, and the value will be the id reference.At present 'Record_Nr' 12, could be a reference for KEMPTON PARK GC - 05/01/2011, or any the other club, it does not know, it just lists the record that matches the value you passed from the manually produced dropdown list.while($row = mysql_fetch_array($result)) { echo '<option value="'.$row['Record_Nr'].'">'.$row['club_name'].'</option>'; } This way you will know the value, and club name will match the id/club name values in the database table exactly. Hi ,I have set up the page to do the following - I think it is what you are also proposing ?<script type="text/javascript">function showUser(str){if (str=="") { document.getElementById("txtHint").innerHTML=""; return; }if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET","MySQLreturntable2.php?q="+str,true);xmlhttp.send(null);}</script><form><select name="users" onchange="showUser(this.value)"><option value="">Select a tournament:</option><option value="1">KEMPTON PARK GC - 05/01/2011</option><option value="2">KYALAMI GC - 07/02/2011</option><option value="3">ST.FRANCIS LINKS - 06/03/2011</option><option value="4">GARDENER ROSS GC - 27/03/2011</option><option value="5">RUSTENBURG GC - 28/03/2011</option><option value="6">WITBANK GC - 31/03/2011</option><option value="7">EBOTSE GE - 03/04/2011</option><option value="8">UMHLALI GE - 06/04/2011</option><option value="9">DURBAN CC - 08/04/2011</option><option value="10">STEENBERG GC - 10/04/2011</option><option value="11">MACCAUVLEI GC - 26/04/2011</option><option value="12">MOUNT EDGECOMBE CC - 02/05/2011</option><option value="13">RANDPARK GC - 22/05/2011</option><option value="14">OUBAAI GC - 12/06/2011</option><option value="15">ZWARTKOP CC - 26/06/2011</option><option value="16">ERPM GC - 30/06/2011</option><option value="17">POLOKWANE GC - 02/07/2011</option><option value="18">ERINVALE - 03/07/2011</option><option value="19">ROYAL CAPE GC - 04/07/2011</option><option value="20">PAARL GC - 05/07/2011</option><option value="21">IRENE CC - 10/07/2011</option><option value="22">STELLENBOSCH GC - 14/07/2011</option><option value="23">MOWBRAY GC - 15/07/2011</option><option value="24">BRYANSTON CC - 31/07/2011</option><option value="25">SCHOEMAN PARK GC - 07/08/2011</option><option value="26">NELSPRUIT GC - 14/08/2011</option><option value="27">THE HILL - 21/08/2011</option><option value="28">MOSSEL BAY GC - 28/08/2011</option><option value="29">WANDERERS GC - 18/09/2011</option><option value="30">Pecanwood Golf Club</option></select></form><br /><div id="txtHint"><b>The Results of the Winners will be listed here.</b></div> With this page and the other page I get the overall result seen in my linkRegardsRob Link to comment Share on other sites More sharing options...
dsonesuk Posted June 27, 2011 Share Posted June 27, 2011 Sorry! With Blob or longblob, the image is converted to binary data. To convert it back to image you would have to write a function to read the binary data, set what mime type (jpeg, png, gif etc) it is, and return the data as that image type.This is open to image corruption during saving and conversion, and increased storage memory usage in database.The usual option is to store filename only in VARCHAR field, and insert into <img> tag src attribute, which is what i was refering to. Link to comment Share on other sites More sharing options...
SA Rob Posted June 27, 2011 Author Share Posted June 27, 2011 Sorry! With Blob or longblob, the image is converted to binary data. To convert it back to image you would have to write a function to read the binary data, set what mime type (jpeg, png, gif etc) it is, and return the data as that image type.This is open to image corruption during saving and conversion, and increased storage memory usage in database.The usual option is to store filename only in VARCHAR field, and insert into <img> tag src attribute, which is what i was refering to.Thanks - I am happy to do it the way that is best.So if I understand correctly then: I have to place a reference for the image in the image field say "http://www.gnjgf.co.za/001.jpg" I would have to change the BLOB attribute to VARCHAR and have enough space allocated for this long name Then lastly have the specific image uploaded using FTP and not to MySQL It should then work ? Link to comment Share on other sites More sharing options...
SA Rob Posted June 27, 2011 Author Share Posted June 27, 2011 Thanks - I am happy to do it the way that is best.So if I understand correctly then: I have to place a reference for the image in the image field say "http://www.gnjgf.co.za/001.jpg" I would have to change the BLOB attribute to VARCHAR and have enough space allocated for this long name Then lastly have the specific image uploaded using FTP and not to MySQL It should then work ?Thank you to everyone that has contributed to my learning and the success of this excercise.I am trying now to do the pdf part. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.