RCS Posted April 7, 2008 Share Posted April 7, 2008 I'm getting an error can anyone tell me what the problem is?? Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /mnt/w0207/d48/s04/b02d745d/www/eamwebdesign.com/upload_file.php on line 50 Could not complete query. $con = mysql_connect($db_host, $db_user, $db_passwd); mysql_select_db($db_name) or die ("Unable to connect to MySQL"); $query = "INSERT INTO upload(name, TYPE, size, content, make, description, price)". "VALUES ('$fileName', '$fileType', '$fileSize', '$content','$_POST[make]','$_POST[description]','$_POST[price]')"; $result=mysql_query($con, $query) or die ("Could not complete query.");(This is the line) DATABASE SETUP IS id INT NOT NULL AUTO_INCREMENT, name VARCHAR(30) NOT NULL, type VARCHAR(30) NOT NULL, size INT NOT NULL, description VARCHAR(350) NOT NULL, price VARCHAR(128) NOT NULL, make VARCHAR(30) NOT NULL, content MEDIUMBLOB NOT NULL, PRIMARY KEY(id) ); Link to comment https://forums.phpfreaks.com/topic/99913-php-help/ Share on other sites More sharing options...
darkfreaks Posted April 7, 2008 Share Posted April 7, 2008 take the connection out of the query line should only be mysql_query query no connection Link to comment https://forums.phpfreaks.com/topic/99913-php-help/#findComment-510917 Share on other sites More sharing options...
RCS Posted April 7, 2008 Author Share Posted April 7, 2008 I have another problem Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt/w0207/d48/s04/b02d745d/www/eamwebdesign.com/catalog.php on line 37 <?php include("dbinfo.inc"); $con = mysql_connect($db_host, $db_user, $db_passwd, $db_name); $query = ("SELECT * FROM upload ORDER BY id"); $result = mysql_query($query) or die('Error, query failed'); echo "<table border='1'> <tr> <th>Make</th> <th>Description</th> <th>Price</th> <th>Picture</th> </tr>"; while($row = mysql_fetch_array ($result)) { THIS IS THE LINE echo "<tr>"; echo "<td>" . $row['make'] . "</td>"; echo "<td>" . $row['description'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "<td><img src =\"" . $row['name']."\"></td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/99913-php-help/#findComment-510924 Share on other sites More sharing options...
darkfreaks Posted April 7, 2008 Share Posted April 7, 2008 <?php while($row = mysql_fetch_assoc ($result)) { //dostuff } ?> Link to comment https://forums.phpfreaks.com/topic/99913-php-help/#findComment-510925 Share on other sites More sharing options...
RCS Posted April 7, 2008 Author Share Posted April 7, 2008 Error, query failed not sure??? why database connect info is working the table is their DATABASE SETUP IS id INT NOT NULL AUTO_INCREMENT, name VARCHAR(30) NOT NULL, type VARCHAR(30) NOT NULL, size INT NOT NULL, content MEDIUMBLOB NOT NULL, make VARCHAR(30) NOT NULL, description VARCHAR(350) NOT NULL, price VARCHAR(128) NOT NULL, PRIMARY KEY(id) ); Link to comment https://forums.phpfreaks.com/topic/99913-php-help/#findComment-510929 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.