|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I'm trying to insert a php file as a value into a mysql user table so when the user signs in, they have access to that php file. The target page it opens on is a php page with the connection to the database stated. <?php include("settings.inc"); // Delete old sessionId's from the table Temp $date_month = date(m); $date_year = date(Y); $date_day = date(d); $time_hour = date(H); $time_min = date(i); $Datesession = "$date_year$date_month$date_day"; if($Username == '') { print("Please enter a username"); } elseif ($Password == '') { print("Please enter a password"); } else { mysql_select_db("appliance_Man", $connection)or die(mysql_error()); $query = "INSERT INTO Usersettings (Username, Password, Date, Answer) VALUES ('$Username', '$Password', $Datesession, "$query1 = mysql_query( \"select Answer, filename, filesize,filetype FROM washer_Ge_Old where itemID=\'21\'\" ); if( mysql_num_rows( $query1 ) == 1 ){ $Answer = mysql_result( $query1,0,0); echo $Answer; } else { echo \"File not found\"; }"); $result = mysql_query($query) or die("ERROR"); print("<script> location.href=\"index.php?Msg=User succesfully added($Username).\"; </script> "); } ?> the error message I keep getting is: Parse error: parse error in /home/sites/site9/web/new/add/wgold21.php on line 22 which is the line i colored in orange above. Does anybody know what is wrong with this? |
|
#2
|
|||
|
|||
|
PHP Code:
The exact error is at , "$query1 . The " closes off your $query = " line and then feeds a bunch of junk data to the parser. Try rewriting like this: PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > inserting a php file to mysql table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|