ballhogjoni Posted April 24, 2007 Share Posted April 24, 2007 Can you please look over this and tell me if there are any errors with this code if (isset($too_small)) { while($row = mysql_fetch_array($sql)){ mysql_query("INSERT INTO dispo_tooSmall (Name, Phone, Email, Position, State) VALUES (.$row['fname'].$row['lname'].,.$row['areacode'].$row['prefix'].$row['linenumber'].,.$row['email'].,.$row['position'].,.$row['state'].)"); mysql_query("DELETE FROM contactinfo WHERE Email='.$row['email'].'"); } ?> Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/ Share on other sites More sharing options...
mpharo Posted April 24, 2007 Share Posted April 24, 2007 the code looks fine, the query looks a little wierd though....are you using mysqli? Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237065 Share on other sites More sharing options...
ballhogjoni Posted April 24, 2007 Author Share Posted April 24, 2007 just mysql. Dont know if thats the same thing. Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237070 Share on other sites More sharing options...
mpharo Posted April 24, 2007 Share Posted April 24, 2007 if you using just mysql you dont need all those periods in there try this.... mysql_query("INSERT INTO dispo_tooSmall (Name, Phone, Email, Position, State) VALUES ('$row[fname] $row[lname]' , '$row[areacode] $row[prefix] $row[linenumber]' , '$row' , '$row[position]' , '$row[state]')"); Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237071 Share on other sites More sharing options...
ballhogjoni Posted April 24, 2007 Author Share Posted April 24, 2007 I am coming up with this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/realfina/public_html/tests/cvlsofttest/leads.php on line 124 Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237074 Share on other sites More sharing options...
mpharo Posted April 24, 2007 Share Posted April 24, 2007 What line is 124, can you post the whole page? Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237084 Share on other sites More sharing options...
only one Posted April 24, 2007 Share Posted April 24, 2007 try this mysql_query("INSERT INTO dispo_tooSmall (`name`, `phone`) VALUES ('$row[fname]','$row[lname]')"); etc.. Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237089 Share on other sites More sharing options...
ballhogjoni Posted April 24, 2007 Author Share Posted April 24, 2007 if (isset($too_small)) { while($row = mysql_fetch_array($sql)){ mysql_query("INSERT INTO dispo_tooSmall (Name, Phone, Email, Position, State) VALUES ('$row['fname'] $row['lname']','$row['areacode'] $row['prefix'] $row['linenumber']','$row['email']','$row['position']','$row['state']')"); // line 124 mysql_query("DELETE FROM contactinfo WHERE Email='$row['email']'"); } ?> Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237100 Share on other sites More sharing options...
mpharo Posted April 24, 2007 Share Posted April 24, 2007 I modified the query in the other post after posting, you cant use [''] in a sql statement, just remove those outta there and just do '$var[var]' NOT '$var['var']' Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237110 Share on other sites More sharing options...
robgolding63 Posted April 24, 2007 Share Posted April 24, 2007 It's because you're missing a comma inbetween here: '$row['areacode'] $row['prefix'] Hope that does it! Rob Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237129 Share on other sites More sharing options...
mpharo Posted April 24, 2007 Share Posted April 24, 2007 He wants that in there, cause it will print a space between the variables... Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237137 Share on other sites More sharing options...
ballhogjoni Posted April 24, 2007 Author Share Posted April 24, 2007 He wants that in there, cause it will print a space between the variables... Thats correct. Thank You mpharo Link to comment https://forums.phpfreaks.com/topic/48475-solved-is-there-any-thing-worng-witht-htis-code/#findComment-237232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.