Jump to content

Disead

Members
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

950 profile views

Disead's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. OK, got it (sort of). I understand the premise of what you are stating. I unfortunately will have to stick with mysqli statements because the way the company wants it set up it HAS to run on the godaddy SQL server that is set up. Could you do me a HUGE favor (you have already helped so much) and show me what that code needs to look like? I understand in what section each part needs to go in, but the syntax eludes me. THANK YOU!!!
  2. Update: Found the source of: Fatal error: Call to a member function bind_param() on a non-object in /home/myusername/public_html/SMQ.php on line 25/13 It was a simple GIGO error on my part; I had accidentally added a P in front of the 98 in: $stmt = $mysqli->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, 98, 98J, 100 FROM SMQSQL WHERE Scott = ?'); So, now that error is gone. Instead, I am now faced with the error: Fatal error: Call to undefined method mysqli_stmt::get_result() in /home/jessicarmosher/public_html/SMQNEW.php on line 16/27 (Depending on whose code has been used) What could be causing this one??? Hint: I have done some searching, and it seems that a lot of people with this error get it because using: $result = $stmt->get_result(); requires the ability to use mysqlnd. I am running this rigged mess on godaddy, and it would seem to me that they should have this installed/enabled. Could this in any way be causing my headaches, or is it something else??? Just read here http://webhostingbits.com/2013/08/do-godaddy-linux-servers-have-mysqlnd-installed/ that apparently mysqlnd is not yet supported by godaddy. Does this mean I might have to instead work with BIND_RESULT and FETCH? So, how can this be written to work around this??? Fingers crossed...
  3. Thank you all, its getting closer, I can definitely tell... I have tried both the above suggestions, here are the results. First, on the original code that everyone so far has been editing here and there (cyberRobot was the last to do so), it now looks like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Online SMQ</title> </head> <body> <form name="searchForm" method="GET" action="#"> <input type="text" name="scott"> <input type="submit" name="submit" value="Search"> </form> <p> </html> <?php $mysqli = new mysqli("localhost", "guestuser", "guestuser", "SMQ"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $validScott = $_GET['scott']; $stmt = $mysqli->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQSQL WHERE Scott = ?'); $stmt->bind_param('s',$validScott); $stmt->execute; $result = $stmt->get_result(); $stmt->close(); $queryResult = ''; while($row = $result->fetch_assoc()){ $queryResult.= " <tr> <td>{$row['Scott']}</td> <td>{$row['Den']}</td> <td>{$row['Color']}</td> <td>{$row['Cond']}</td> <td>{$row['70']}</td> <td>{$row['70J']}</td> <td>{$row['75']}</td> <td>{$row['75J']}</td> <td>{$row['80']}</td> <td>{$row['80J']}</td> <td>{$row['85']}</td> <td>{$row['85J']}</td> <td>{$row['90']}</td> <td>{$row['90J']}</td> <td>{$row['95']}</td> <td>{$row['95J']}</td> <td>{$row['98']}</td> <td>{$row['98J']}</td> <td>{$row['100']}</td> </tr> "; } ?> <!DOCTYPE html> <table> <tr> <td>Scott</td> <td>Den</td> <td>Color</td> <td>Cond</td> <td>70</td> <td>70J</td> <td>75</td> <td>75J</td> <td>80</td> <td>80J</td> <td>85</td> <td>85J</td> <td>90</td> <td>90J</td> <td>95</td> <td>95J</td> <td>98</td> <td>98J</td> <td>100</td> <tr> <?php echo $queryResult; ?> </table> </body> </html> The syntax error is gone (thanks cyberRobot) but I am now getting this error when trying to execute: Fatal error: Call to a member function bind_param() on a non-object in /home/myusername/public_html/SMQ.php on line 25 As far as the code given to me by mac_guyver (thank you!!!), I have not changed any of the code whatsoever, just loaded it in, set the correct password, and tested it. I got the same error here too: Fatal error: Call to a member function bind_param() on a non-object in /home/myusername/public_html/SMQNEW.php on line 13 basically, both times, it throws the error based on this: $stmt->bind_param('s',$validScott); Hint: I checked the DB permissions of my user "guestuser" that I use to connect with, set the permissions to allow everything to check if this was the culprit, and it did NOT change the error. Now what??? SOOOO CLOSE!!!!!! I'm going to owe a lot of people a lot of beer (or other preferred consumable) when this is done...
  4. 1. Updated this $queryResult.= " <tr> <td>$row[Scott]</td> <td>$row[Den]</td> <td>$row[Color]</td> <td>$row[Cond]</td> <td>$row[70]</td> <td>$row[70J]</td> <td>$row[75]</td> <td>$row[75J]</td> <td>$row[80]</td> <td>$row[80J]</td> <td>$row[85]</td> <td>$row[85J]</td> <td>$row[90]</td> <td>$row[90J]</td> <td>$row[95]</td> <td>$row[95J]</td> <td>$row[98]</td> <td>$row[98J]</td> <td>$row[100]</td> </tr> to this: $queryResult.= " <tr> <td>$row['Scott']</td> <td>$row['Den']</td> <td>$row['Color']</td> <td>$row['Cond']</td> <td>$row['70']</td> <td>$row['70J']</td> <td>$row['75']</td> <td>$row['75J']</td> <td>$row['80']</td> <td>$row['80J']</td> <td>$row['85']</td> <td>$row['85J']</td> <td>$row['90']</td> <td>$row['90J']</td> <td>$row['95']</td> <td>$row['95J']</td> <td>$row['98']</td> <td>$row['98J']</td> <td>$row['100']</td> </tr> It looks like it moved the Dreamweaver syntax error to line 35 though. 2. Added line 29 here to define var as empty string first: $stmt->close(); $queryResult = ''; while($row = $result->fetch_assoc()){ $queryResult.= " 3. I fixed the $mysqli / $db discrepancy here: $mysqli = new mysqli("localhost", "guestuser", "guestuser", "SMQ"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $validScott = $_GET['scott']; $stmt = $mysqli->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQSQL WHERE Scott = ?'); 4. I (believe) fixed the difference between the database/table name discrepancy as well, you were right in that I had mis-named the table; I believe the database name is SMQ and the table name is SMQSQL as seen here: So now in line 16 it refers to a database named SMQ vs. line 23 is now FROM SMQSQL: $mysqli = new mysqli("localhost", "guestuser", "guestuser", "SMQ"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $validScott = $_GET['scott']; $stmt = $mysqli->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQSQL WHERE Scott = ?'); So, I believe I have fixed everything that was caught this time. To answer the question of where the error reporting is coming from, its coming from the Browser Console within Firefox, as I have been trying to figure out why I am getting a blank page when trying to access /SMQ.php online. Of which, by the way, I am still getting the same error from the Console: ":The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." That is the error that pops up whenever I try to access the page at /SMQ.php. The complete code is now: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Online SMQ</title> </head> <body> <form name="searchForm" method="GET" action="#"> <input type="text" name="scott"> <input type="submit" name="submit" value="Search"> </form> <p> <?php $mysqli = new mysqli("localhost", "guestuser", "guestuser", "SMQ"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $validScott = $_GET['scott']; $stmt = $mysqli->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQSQL WHERE Scott = ?'); $stmt->bind_param('s',$validScott); $stmt->execute; $result = $stmt->get_result(); $stmt->close(); $queryResult = ''; while($row = $result->fetch_assoc()){ $queryResult.= " <tr> <td>$row['Scott']</td> <td>$row['Den']</td> <td>$row['Color']</td> <td>$row['Cond']</td> <td>$row['70']</td> <td>$row['70J']</td> <td>$row['75']</td> <td>$row['75J']</td> <td>$row['80']</td> <td>$row['80J']</td> <td>$row['85']</td> <td>$row['85J']</td> <td>$row['90']</td> <td>$row['90J']</td> <td>$row['95']</td> <td>$row['95J']</td> <td>$row['98']</td> <td>$row['98J']</td> <td>$row['100']</td> </tr> "; } ?> <table> <tr> <td>Scott</td> <td>Den</td> <td>Color</td> <td>Cond</td> <td>70</td> <td>70J</td> <td>75</td> <td>75J</td> <td>80</td> <td>80J</td> <td>85</td> <td>85J</td> <td>90</td> <td>90J</td> <td>95</td> <td>95J</td> <td>98</td> <td>98J</td> <td>100</td> <tr> <?php echo $queryResult; ?> </table> </body> </html> PS Thank you guys so much for your help, this means a LOT to me!!!
  5. I went ahead and reordered a couple items and added a couple short lines, hoping it would fix it. It now looks like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Online SMQ</title> </head> <body> <form name="searchForm" method="GET" action="#"> <input type="text" name="scott"> <input type="submit" name="submit" value="Search"> </form> <p> <?php $mysqli = new mysqli("localhost", "guestuser", "guestuser", "SMQ"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $validScott = $_GET['scott']; $stmt = $db->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQ WHERE Scott = ?'); $stmt->bind_param('s',$validScott); $stmt->execute; $result = $stmt->get_result(); $stmt->close(); while($row = $result->fetch_assoc()){ $queryResult.= " <tr> <td>$row[Scott]</td> <td>$row[Den]</td> <td>$row[Color]</td> <td>$row[Cond]</td> <td>$row[70]</td> <td>$row[70J]</td> <td>$row[75]</td> <td>$row[75J]</td> <td>$row[80]</td> <td>$row[80J]</td> <td>$row[85]</td> <td>$row[85J]</td> <td>$row[90]</td> <td>$row[90J]</td> <td>$row[95]</td> <td>$row[95J]</td> <td>$row[98]</td> <td>$row[98J]</td> <td>$row[100]</td> </tr> "; } ?> <table> <tr> <td>Scott</td> <td>Den</td> <td>Color</td> <td>Cond</td> <td>70</td> <td>70J</td> <td>75</td> <td>75J</td> <td>80</td> <td>80J</td> <td>85</td> <td>85J</td> <td>90</td> <td>90J</td> <td>95</td> <td>95J</td> <td>98</td> <td>98J</td> <td>100</td> <tr> <?php echo $queryResult; ?> </table> </body> </html> This swapped the order of the form and sql connect, and added lines 7, 13, 84, and 85, as well as removed the duplicate <?php and ?> that were left over from the previous order, all in an attempt to cross my t's and dot my i's so to speak. Still getting the "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." Error, as well as Dreamweaver saying there is a syntax error in line 38. ???
  6. And I'm confused by the error The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. SMQ.php because isn't that what this: <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>Online SMQ</title> </head> covers?
  7. Alright, I made the recommended changes. Still getting a blank screen. Error reporting says: TypeError: can't access dead object jquery-1.10.2.min.js:6 TypeError: can't access dead object jquery-1.10.2.min.js:6 TypeError: can't access dead object jquery-1.10.2.min.js:6 The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. SMQ.php TypeError: can't access dead object jquery-1.10.2.min.js:6 TypeError: can't access dead object jquery-1.10.2.min.js:6 TypeError: can't access dead object jquery-1.10.2.min.js:6 This is the edited php I used: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Online SMQ</title> </head> <?php $mysqli = new mysqli("localhost", "guestuser", "guestuser", "SMQ"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } ?> <form name="searchForm" method="GET" action="#"> <input type="text" name="scott"> <input type="submit" name="submit" value="Search"> </form> <?php $validScott = $_GET['scott']; $stmt = $db->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQ WHERE Scott = ?'); $stmt->bind_param('s',$validScott); $stmt->execute; $result = $stmt->get_result(); $stmt->close(); while($row = $result->fetch_assoc()){ $queryResult.= " <tr> <td>$row[Scott]</td> <td>$row[Den]</td> <td>$row[Color]</td> <td>$row[Cond]</td> <td>$row[70]</td> <td>$row[70J]</td> <td>$row[75]</td> <td>$row[75J]</td> <td>$row[80]</td> <td>$row[80J]</td> <td>$row[85]</td> <td>$row[85J]</td> <td>$row[90]</td> <td>$row[90J]</td> <td>$row[95]</td> <td>$row[95J]</td> <td>$row[98]</td> <td>$row[98J]</td> <td>$row[100]</td> </tr> "; } ?> <table> <tr> <td>Scott</td> <td>Den</td> <td>Color</td> <td>Cond</td> <td>70</td> <td>70J</td> <td>75</td> <td>75J</td> <td>80</td> <td>80J</td> <td>85</td> <td>85J</td> <td>90</td> <td>90J</td> <td>95</td> <td>95J</td> <td>98</td> <td>98J</td> <td>100</td> <tr> <?php echo $queryResult; ?> </table> Dreamweaver is still saying there is a syntax error in line 39: <td>$row[70J]</td>
  8. OK, here it is. I have been trying to do this myself, but it has been driving me insane and I turn to professionals here for help. I am a basic web developer for a company that I work for in other capacities. I have a reasonable understanding of HTML and that is about where my expertise ends. I am not typically a programmer, just a simple (extremely) part time designer that uses Muse and Dreamweaver when necessary. However, recently my company has asked me to accomplish a task for their website. In plain English, they want a large database that exists currently as a CVS file made into a searchable web page. It is 21 columns by approximately 6,700 rows. To explain what I need a little more technically, here are my ideas and where I have gotten to so far: 1. The company uses godaddy, into which I *believe* I have successfully imported the spreadsheet. I believe it is successful because through godaddy's SQL Control Panel (phpMyAdmin console), I can do the EXACT searches that the company needs, and it spits out the EXACT results that I need. 2. The end result needs to be a .php that I can upload to the website's root folder that can be then inserted into premade pages using: <iframe src="SMQ.php" scrolling="yes" width="950" height="800"></iframe> 3. On the .php page, I need to have a way to log in to the SQL server and a simple search box built in that will allow the user to input a very simple search string consisting of no more than 4 numbers and 3 letters at a time. No buttons, no check boxes, just a search box. 3. This query then needs to be output as a nice data table, similar to this: This in fact is a screenshot of a search I performed out of my SQL database, in phpMyAdmin using the column "Scott" for the search, and the number 226 as the search term. All column names are visible with the exception of the first column, entitled LINEID, made to be the key, and the output should not include the key but have everything else as above. 4. I can see what the simple line of php is that performed this task: SELECT * FROM `SMQSQL` WHERE `Scott` = '226' ORDER BY `LINEID` ASC but I can't figure out how the hell to get this incorporated to a .php search. To sum it up, I need a .php page written that can connect to a SQL database, perform a data based search, and spit out a clean table when it is done. I had accomplished this in the past using an import into google docs and using it to perform a search and result display via the following code built into a php called SMQ.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Example of Google Spreadsheet Data Visualisation</title> </head> <body> <form id="form1" method="post" action ="<?php echo $_SERVER['PHP_SELF']; ?>"> <label> <input id="search" name="search" type="text" /> </label> <label> <input id="Scott #" name="Scott #" type="submit" value="Scott #" /> </label> <img src="loading.gif" width="16" height="11" /> </form> <p> <?php $search= $_REQUEST['search']; if ($search > ''){ $search = $search;} else { $search = '';} ?> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['table']}); </script> <script type="text/javascript"> var visualization; function drawVisualization() { var query = new google.visualization.Query( 'https://docs.google.com/spreadsheet/ccc?key=0AronCwm9QPefdGpIUllscGgtLUJod2pOazc0bjU0cUE&usp=sharing'); query.setQuery('SELECT A, B, C, D, E, F, G, H, I, J, K, L, M, N, O ,P ,Q ,R ,S ,T WHERE (A) LIKE ("<?php echo $search; ?>") order by A asc label A "Scott #", B "Den", C "Color", D "Cond", E "40", F "60", G "70", H "70J", I "75", J "75J", K "80", L "80J", M "85", N "85J", O "90", P "90J", Q "95", R "95J", S "98", T "98J"'); query.send(handleQueryResponse); } function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + '' + response.getDetailedMessage()); return; } var data = response.getDataTable(); visualization = new google.visualization.Table(document.getElementById('table')); visualization.draw(data, { page: 'enable', page: 16, pageSize: 16, legend: 'bottom'}); } google.setOnLoadCallback(drawVisualization); </script> <div id="table"></div> </div> </body> </html> But as you can see, this may not be the most secure thing in the world, plus we want to be able to expand it in the future and not be so simplistic, hence the need to switch to SQL. Please let me know right away by contacting me at disead@gmail.com if this is something YOU might be able to help with. I'm sure for an experienced programmer, once you have the details from me that you need, it would take maybe 10 minutes to write. I don't have much, but I can pay a little bit for this one time job. If it ends up working out, I may be able to pay more down the line for more advanced options such as being able to do drop-down searches based on the column titled "ISSUE", as well as more things down the line as it grows. Thank you so much, I hope to hear from someone soon!!!
  9. OK, here it goes. I made the changes you suggested below as you will see in the Code. I went ahead and saved it as SMQ.php and uploaded it to my test site. If I remember correctly, I should just be able to go to www.(mytestsite).com/SMQ.php and have the php section work when accessed directly through say Firefox, correct? On a slight side note, I have done this months ago in the past, and it has worked, but I was working with sort of a "kid version" of SQL, referencing my .php to a google doc instead of a SQL server, but that was limited in ability, thus the switch to SQL. However, with that setup, I COULD go to www.(mytestsite).com/SMQ.php and it would actually come up just fine. So, the problem now is this. I upload my SMQ.php, same as I did when it worked with google docs, same location. It shows in my File Manager that the file is in fact there and exists. I can download it from the File Manager and get the exact file that I had uploaded, the one you helped me with. However, if I try to go directly to www.(mytestsite).com/SMQ.php, nothing happens, as in, nothing at all. I do not get a 404 error saying that nothing is there, I just get a blank white screen. When I go to look at the page source, instead of the code that should be there, I get a blank page. Is it something I did wrong in writing the php file? Its below, take a look and let me know what you think please.... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Online SMQ</title> </head> <?php $mysqli = new mysqli("localhost", "guestuser", "guestuserpassword1", "SMQ"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } ?> <form name="searchForm" method="GET" action="#"> <input type="text" name="scott"> <input type="submit" name="submit" value="Search"> </form> <?php $validScott = $_GET['scott']; $stmt = $db->prepare('SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQ WHERE Scott = ?'); $stmt->bind_param('s',$validScott]); $stmt->execute; $result = $stmt->get_result(); $stmt->close(); while($row = $result->fetch_accos()){ $queryResult.= " <tr> <td>$row[Scott]</td> <td>$row[Den]</td> <td>$row[Color]</td> <td>$row[Cond]</td> <td>$row[70]</td> <td>$row[70J]</td> <td>$row[75]</td> <td>$row[75J]</td> <td>$row[80]</td> <td>$row[80J]</td> <td>$row[85]</td> <td>$row[85J]</td> <td>$row[90]</td> <td>$row[90J]</td> <td>$row[95]</td> <td>$row[95J]</td> <td>$row[98]</td> <td>$row[98J]</td> <td>$row[100]</td> </tr> "; } ?> <table> <tr> <td>Scott</td> <td>Den</td> <td>Color</td> <td>Cond</td> <td>70</td> <td>70J</td> <td>75</td> <td>75J</td> <td>80</td> <td>80J</td> <td>85</td> <td>85J</td> <td>90</td> <td>90J</td> <td>95</td> <td>95J</td> <td>98</td> <td>98J</td> <td>100</td> <tr> <?php echo $queryResult; ?> </table> Dreamweaver is reporting a syntax error on lines 25 which is $stmt->bind_param('s',$validScott]); and line 39 which is <td>$row[70J]</td> THANK YOU!!!
  10. Thank you paddy_fields, I will try out your suggestions and come back with (hopefully) positive results!
  11. Hey all, I need your help! So, I am the web designer for a small company, but I use that term loosely as I for the most part am limited to design through Dreamweaver and Muse. I know a decent amount of HTML off the top of mey head, but when it comes to PHP, yikes... My company asked me to make a simple searchable web page based on their price guide/catalog, built into their website. I have MySQL set up within their godaddy. I can use the SQL search functions to get the exact results back that I need, and the SQL cPanel gives me the following code: SELECT * FROM `SMQSQL` WHERE `Scott` = '(Whatever I search for)' ORDER BY `LINEID` ASC This makes sense to me up to here; this is very simple language, However, I have been pulling my hair out for days trying to get a simple search function as an actual PHP *PAGE* going. Basically, I need to set up a PHP form search (not hard) that will go back and log in to my SQL database named SMQ (not too bad yet), perform a search out of a specific column named Scott (getting a little harder, and somewhat lost), take the search results from specific columns (getting harder), and display them in a neat little table (now I'm lost). My SQL database is set up with the following columns: LINEID, Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, 98, 98J, 100 Where LINEID is the index. LINEID is set to INT (5 char), the next 4 are TEXT (255 char, item descriptors), and the rest INT (9 char; prices). When the results are displayed, I would like all but the LINEID visible. I have tried and tried and tried playing with my PHP coding but am ready to shoot my computer. Here it is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Online Search</title> </head> <body> <h3>Search Online</h3> <p>You may search by Catalog number. Please use the exact Catalog number or you may receive an error. Please note that if searching for more than a basic item, include the full Catalog number WITHOUT spaces.</p> <form method="post" action="search.php?go" id="searchform"> <input type="text" name="Scott"> <input type="submit" name="submit" value="Search"> </form> <?php if(isset($_POST['submit'])){ if(isset($_GET['go'])){ $Scott=$_POST['Scott'];; $db=mysql_connect ("localhost", "guestuser", "guestuser") or die ('Error connecting to the database. Error: ' . mysql_error()); $mydb=mysql_select_db("SMQ"); $sql="SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQ WHERE Scott LIKE '%" . $Scott . "%'; $result=mysql_query($sql); while($row=mysql_fetch_array($result)){ $Scott=$row['Scott']; $Den=$row['Den']; $Color=$row['Color']; $Cond=$row['Cond']; $70=$row['70']; $70J=$row['70J']; $75=$row['75']; $75J=$row['75J']; $80=$row['80']; $80J=$row['80J']; $85=$row['85']; $85J=$row['85J']; $90=$row['90']; $90J=$row['90J']; $95=$row['95']; $95J=$row['95J']; $98=$row['98']; $98J=$row['98J']; $100=$row['100']; echo "<ul>\n"; echo "<li>" . "<a href=\"SMQ.php?id=$Scott\">" .$Scott . " " . $Den . " " . $Color . " " . $Cond . " " . $70 . " " . $70J . " " . $75 . " " . $75J . " " . $80 . " " . $80J . " " . $85 . " " . $85J . " " . $90 . " " . $90J . " " . $95 . " " . $95J . " " . $98 . " " . $98J . " " . $100 . "</a></li>\n"; echo "</ul>"; } } else{ echo "<p>Please enter a search query</p>"; } ?> I know it's probably pretty bad, but hopefully at least you can get an idea of what I'm trying to accomplish. Please dear God tell me what I am doing wrong! I'm sure it will take a knowledgeable user 5 minutes to fix this, but you would be saving my skin! THANKS!!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.