Forum Moderators: coopster
Here is my connection code and the error it throws.
$con = mysql_connect("localhost","xx","xx") or die('Could not connect: ' . mysql_error());
mysql_select_db("WIM",$con) or die(mysql_error());
//sets query string from previously run code
$query = substr($strsql,0, strlen($strsql)-5);
$result = mysql_query($query) or die(mysql_error($result)." query: X".$query."x");
mysql_close($con);
Throws the error:
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /var/www/wim/test.php on line 134
query: XInsert into wim03_08 (fips, stid , dir, ln , year, month, day, hour, dow, class, twght, numaxles, A, Asp, B, Bsp, C, Csp , D, Dsp, E, Esp, F, Fsp, G, Gsp, H, Hsp, I, Isp , J , Jsp , K , Ksp, L, Lsp) Values (36,'000199',1,2,08,03,01,00,6,08,0228,04,041,039,097,111,048,012,042,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(36,'000199',1,2,08,03,01,00,6,08,0253,04,039,039,098,117,061,012,055,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)x
Having created this table previously this insert statement successfully executes in phpmysql, any help?
[edited by: eelixduppy at 6:23 pm (utc) on April 2, 2009]
[edit reason] removed specifics [/edit]
Your query is not correct:
Insert into wim03_08 (fips, stid , dir, ln , year, month, day, hour, dow, class, twght, numaxles, A, Asp, B, Bsp, C, Csp , D, Dsp, E, Esp, F, Fsp, G, Gsp, H, Hsp, I, Isp , J , Jsp , K , Ksp, L, Lsp) Values (36,'000199',1,2,08,03,01,00,6,08,0228,04,041,039,097,111,048,012,042,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(36,'000199',1,2,08,03,01,00,6,08,0253,04,039,039,098,117,061,012,055,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Insert into wim03_08 (fips, stid , dir, ln , year, month, day, hour, dow, class, twght, numaxles, A, Asp, B, Bsp, C, Csp , D, Dsp, E, Esp, F, Fsp, G, Gsp, H, Hsp, I, Isp , J , Jsp , K , Ksp, L, Lsp) Values (36,'000199',1,2,08,03,01,00,6,08,0228,04,041,039,097,111,048,012,042,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
Insert into wim03_08 (fips, stid , dir, ln , year, month, day, hour, dow, class, twght, numaxles, A, Asp, B, Bsp, C, Csp , D, Dsp, E, Esp, F, Fsp, G, Gsp, H, Hsp, I, Isp , J , Jsp , K , Ksp, L, Lsp) Values (36,'000199',1,2,08,03,01,00,6,08,0253,04,039,039,098,117,061,012,055,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
INSERT statements that use VALUES syntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas.Resource: INSERT Syntax [dev.mysql.com]
You have two different connection names: $con on your first post and $conn on the second post.
Two different members, two different posts, Habtom ;)
Welcome to WebmasterWorld, Yuen.
But I believe Habtom is right about something being amiss with your connection.