PHP - Errors In Sql Syntax
anyone know why i would be getting errors in these SQL statements or how to debug?
$sql3="SELECT FROM $tbl_name2(`id`,`FirstName`,`LastName`,`Username`,`Password`,`Password2`,`email`,`Zip`,`Birthday`,`Security`,`Security2`) VALUES ('$id','$FirstName','$LastName','$UserName','$Password','$Password2','$email','$Zip','$Birthday','$Security','$Security2')"; $result3=mysql_query($sql3) or die(mysql_error()); $sql5="select * from $tbl_name where username = '$UserName'"; the error(s) is just the generic one such as Code: [Select] 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 'FROM (`id`,`FirstName`,`LastName`,`Username`,`Password`,`Password2`,`email`,`Zip' at line 1 Similar TutorialsHi all, I am new to PHP and wish to use it simply to collect form data and email it to myself. From what I have gathered from PHP tutorials I have write the following script but I am getting syntax error warnings and cant figure out why. Can somebody please tell me where I am going wrong and if this script will actually work? The line I am getting errors on is Code: [Select] <?php //message contains $message = "Name:$name</br>Email:$email</br>Phone:$phone</br>Preferred Date:$date</br>Best Time To Contact:$time"; ?> Thank you in advance. Code: [Select] <body> <?php //my email $recipient = "info@hairlosslasergroup.co.uk"; //persons name $name = htmlspecialchars($_POST['name']); //persons email $email = htmlspecialchars($_POST['email']); if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) { die("E-mail address not valid"); } //persons phone number $phone = htmlspecialchars($_POST['phone']); //preferred date $date = htmlspecialchars($_POST['comments']); //best time $time = htmlspecialchars($_POST['time']); //check required fields $required = check_input($_POST['required'], "Please go back and complete all required fields"); //email subject $subject = ($_POST['subject'] //message contains $message = "Name:$name</br>Email:$email</br>Phone:$phone</br>Preferred Date:$date</br>Best Time To Contact:$time"; //message mail($recipient, $subject, $message); //redirect to thank you page header('Location:$redirect'); ?> </body> </html> I have a form that is passing the User to following code. The code below is just ported from another site that I created, which works extremely well. I've had to change the datatable, database connection and some of the variables for this site, but it's otherwise the same. I've triple checked the variables. The datatable is accurate. It doesn't appear to be passing variable from the Form with the exception of "content", and I'm getting the following error: Quote 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 'year='', position='', content='Test', ppg='', rp' at line 6 Query: INSERT INTO players SET playerFirst='', playerLast='', feet='', inches='' year='', position='', content='Test', ppg='', rpg='', apg='', spg='', bpg='', fgp='', ftp='', status='' What am I missing? Code: [Select] <?php include('db.php'); $playerFirst = $_POST['playerFirst']; $playerLast = $_POST['playerLast']; $feet = $_POST['feet']; $inches = $_POST['inches']; $year = $_POST['year']; $position = $_POST['position']; $content = $_POST['content']; $ppg = $_POST['ppg']; $rpg = $_POST['rpg']; $apg = $_POST['apg']; $spg = $_POST['spg']; $bpg = $_POST['bpg']; $fgp = $_POST['fgp']; $ftp = $_POST['ftp']; $status = $_POST['status']; //if(isSet($_POST['playerFirst']['playerLast']['feet']['inches']['year']['status'])) //{ /* search for existing row */ $sql = "SELECT msg_id FROM players WHERE playerFirst='".mysql_real_escape_string($playerFirst)."' AND playerLast='".mysql_real_escape_string($playerLast)."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } if(mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); /* update existing row */ $sql = "UPDATE players SET feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."' year='".mysql_real_escape_string($year)."', position='".mysql_real_escape_string($position)."', content='".$content."', ppg='".$ppg."', rpg='".$rpg."', apg='".$apg."', spg='".$spg."', bpg='".$bpg."', fgp='".$fgp."', ftp='".$ftp."', status='".$status."', WHERE msg_id='".$row['msg_id']."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } else { /* insert new row */ $sql = "INSERT INTO players SET playerFirst='".mysql_real_escape_string($playerFirst)."', playerLast='".mysql_real_escape_string($playerLast)."', feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."' year='".mysql_real_escape_string($year)."', position='".mysql_real_escape_string($position)."', content='".$content."', ppg='".$ppg."', rpg='".$rpg."', apg='".$apg."', spg='".$spg."', bpg='".$bpg."', fgp='".$fgp."', ftp='".$ftp."', status='".$status."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } <?php error_reporting(E_ALL); session_start(); include ("dbcon.php"); echo "include working"; $username1= ($_POST['username']); echo ($_POST['username']); if ($_POST) { if (!empty($_POST['username']) && !empty($_POST['pass'])) { $sql = "SELECT * FROM `user` WHERE `username`='($_POST['username'])' LIMIT 1"; $result = mysqli_query($sql); if (mysqli_num_rows($result) > 0) { //user is valid, check pass $query = mysqli_fetch_assoc($result); $password = ($_POST['pass']); if ($password !== $query['pass']) { //invaid pass, input error code echo "Wrong Password"; exit; } else { //valid user and pass, login $_SESSION['login'] = TRUE; $_SESSION['username'] = $_POST['username']; //echo "logged in"; header('location: home.php'); exit(); } } else { //user is not in database, input error code echo " User Not Found"; } } else { //form submitted but no username/password, input error code echo "Fields are Blank"; } } else { //page loaded, but no form submitted, input error code echo "Submition Error"; } ?>I can't figure out the problem........ Any help is appreciated! I used to have a straight forward piece of code that updated multiple rows of info using a foreach loop. However, ever since I've introduced a textarea box into the mix, it's been throwing up syntax errors. Here's my textarea box: Code: [Select] <textarea id=\"detail[]\" name=\"detail[]\" rows=\"7\" cols=\"35\" wrap=\"hard\">$data[detail]</textarea> And here's my UPDATE query: Code: [Select] foreach($_POST['mid'] as $key=>$val) { mysql_query("UPDATE val_mworks SET mworks_percent = ".$_POST['percent'][$key].", mworks_detail = ".$_POST['detail'][$key].", mworks_qty = ".$_POST['qty'][$key]." WHERE mworks_id = $val ") or die(mysql_error()); } Can anyone see anything obvious that I'm doing wrong? I have been looking at this code most of the morning and do not have a clue what is wrong with the code. I am hoping its not a stupid mistake, can someone please help me out? thank you
<title>Inputing Travel Detials</title> <header> <h1 align="center"> Adding Travel Detials </h1> <body> <p> <center><img src="cyberwarfareimage1.png" alt="Squadron logo" style="width:200px;height:200px" style="middle"></center> <table border="1"> <tr> <td><a href="index.php"> Home Page </a></td> <td><a href="administratorhomepage.html">Administrator Home Page </a></td> <td><a href="viewhomepage.html">View Home Page </a></td> <td><a href="Inputhomepage.html">Input Home Page </a></td> <td><a href="traveldetials.html">Enter More Travel Detials </a></td> </table> </p> <?php include "connection.php"; $Applicant_ID = $_POST["Applicant_ID"]; $Method_Of_Travel = $_POST["Method_Of_Travel"]; $Cost = $_POST["Cost"]; $ETA = $_POST["ETA"]; $Main_Gate_Advised = $_POST["Main_Gate_Advised"]; $query = ("UPDATE `int_board_applicant` SET `Method_Of_Travel`=`$Method_Of_Travel', `Cost`=`$Cost', `ETA`='$ETA', `Main_Gate_Advised`='$Main_Gate_Advised' WHERE `Applicant_ID`='$Applicant_ID'"); $result = mysqli_query($dbhandle, $query) or die(mysqli_error($dbhandle)); if($result){ echo "Success!"; } else{ echo "Error."; } // successfully insert data into database, displays message "Successful". if($query){ echo "Successful"; } else { echo "Data not Submitted"; } //closing the connection mysqli_close($dbhandle) ?> Ok this is puzzleing. I am geting "Could not delete data: 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 '1' at line 1". but its is deleting the entry that needs to be removed. The "1" is the entry. Just not sure what is causing the error. I do have another delete php but I have put that on the back burning for the time being.
<?php $con = mysqli_connect("localhost","user","password","part_inventory"); // Check connection if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { $result = mysqli_query($con, "SELECT * FROM amp20 "); $amp20ptid = $_POST['amp20ptid']; // escape variables for security $amp20ptid = mysqli_real_escape_string($con, $_POST['amp20ptid']); mysqli_query($con, "DELETE FROM amp20 WHERE amp20ptid = '$amp20ptid'"); if (!mysqli_query($con, $amp20ptid)); { die('Could not delete data: ' . mysqli_error($con)); } echo "Part has been deleted to the database!!!\n"; mysqli_close($con); } ?> Hi guys
I have this code below and all works fine when submitting this online application apart from when someone types either ' # & into one of the comment fields in which it throws up the error. Have tried various fixes from across the internet but no joy. Can anyone offer suggestions?
<?php
$con = mysql_connect("localhost:3306","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('sfapp', $con);
$sql="INSERT INTO 'sfapp' ('surname_add','forename_add','dob_add','hometele_add','mobiletele_add','homeadd_add','siblings_add','schoolname_add','headname_add','schooladd_add','schooltele_add','schoolem_add','alevel_add','personstate_add','nameprovided_add','pe_add','se_add','PredGrade_Art','PredGrade_AScience','PredGrade_BusStudies','PredGrade_Electronics','PredGrade_EnglishLang','PredGrade_EnglishLit','PredGrade_French','PredGrade_German','PredGrade_Geog','PredGrade_Graphics','PredGrade_History','PredGrade_Maths','PredGrade_SepScience','PredGrade_ProductDesign','PredGrade_Spanish','PredGrade_Other','Gender_Male','Gender_Female','Sub_EnglishLit','Sub_Maths','Sub_FurtherMaths','Sub_Biology','Sub_Chemistry','Sub_Physics','Sub_French','Sub_German','Sub_Spanish','Sub_Geography','Sub_History','Sub_RE','Sub_FineArt','Sub_Business','Sub_Computing','Sub_GlobPersp','Sub_DramaAndTheatre','Sub_PE','Sub_Dance','Sub_Politics','Sub_Psychology','Sub_Sociology','readprospect_chk','Sib_Yes','Sib_No','Current_Student_Yes','Current_Student_No','I_Understand_chk','Current_Education_chk','Local_Care_chk','Staff_Cwhls_chk','Sub_Film')
VALUES
('$_POST[surname_add]','$_POST[forename_add]','$_POST[dob_add]','$_POST[hometele_add]','$_POST[mobiletele_add]','$_POST[homeadd_add]','$_POST[siblings_add]','$_POST[schoolname_add]','$_POST[headname_add]','$_POST[schooladd_add]','$_POST[schooltele_add]','$_POST[schoolem_add]','$_POST[alevel_add]','$_POST[personstate_add]','$_POST[nameprovided_add]','$_POST[pe_add]','$_POST[se_add]','$_POST[PredGrade_Art]','$_POST[PredGrade_AScience]','$_POST[PredGrade_BusStudies]','$_POST[PredGrade_Electronics]','$_POST[PredGrade_EnglishLang]','$_POST[PredGrade_EnglishLit]','$_POST[PredGrade_French]','$_POST[PredGrade_German]','$_POST[PredGrade_Geog]','$_POST[PredGrade_Graphics]','$_POST[PredGrade_History]','$_POST[PredGrade_Maths]','$_POST[PredGrade_SepScience]','$_POST[PredGrade_ProductDesign]','$_POST[PredGrade_Spanish]','$_POST[PredGrade_Other]','$_POST[Gender_Male]','$_POST[Gender_Female]','$_POST[Sub_EnglishLit]','$_POST[Sub_Maths]','$_POST[Sub_FurtherMaths]','$_POST[Sub_Biology]','$_POST[Sub_Chemistry]','$_POST[Sub_Physics]','$_POST[Sub_French]','$_POST[Sub_German]','$_POST[Sub_Spanish]','$_POST[Sub_Geography]','$_POST[Sub_History]','$_POST[Sub_RE]','$_POST[Sub_FineArt]','$_POST[Sub_Business]','$_POST[Sub_Computing]','$_POST[Sub_GlobPersp]','$_POST[Sub_DramaAndTheatre]','$_POST[Sub_PE]','$_POST[Sub_Dance]','$_POST[Sub_Politics]','$_POST[Sub_Psychology]','$_POST[Sub_Sociology]','$_POST[readprospect_chk]','$_POST[Sib_Yes]','$_POST[Sib_No]','$_POST[Current_Student_Yes]','$_POST[Current_Student_No]','$_POST[I_Understand_chk]','$_POST[Current_Education_chk]','$_POST[Local_Care_chk]','$_POST[Staff_Cwhls_chk]','$_POST[Sub_Film]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
?>
<?php
//if "email" variable is filled out, send email
if (isset($_REQUEST['pe_add'])) {
//Email information
$admin_email = $_REQUEST['pe_add'];
$forename = $_REQUEST['forename_add'];
$email = "autoreply@testing.com";
$subject = "Application";
$desc =
"Dear $forename
Thank you for submitting your online application, we will be in touch shortly.
"
;
//send email
mail($admin_email, "$subject", "$desc", "From:" . $email);
//Email response
echo "Thank you for contacting us!";
}
//if "email" variable is not filled out, display the form
else {
?>
If you are seeing this, you need to go back and fill out the Personal Email section!
<?php
}
header("location:complete.php");
mysql_close($con)
?>
Thanks in advance.
How do I display the actual errors in IIS 7.5? If I miss a semicolon, I get: "HTTP Error 500.0 - Internal Server Error" absolutely useless. In prior versions, I could see the line and get to the PHP error. How do I display PHP errors? I've added: set_ini('display_errors', '1'); but it doesn't help. Hi.. I create mysql syntax for query testing before i input to my php code here is my mysql code: Code: [Select] set @t = 0; set @rqty=31968; SELECT LOT_CODE as code, DATE_ENTRY, CASE WHEN @t+OUTPUT_QTY > @rqty THEN @rqty -@t ELSE OUTPUT_QTY END as qty, @t := @t + d.OUTPUT_QTY as cumulative FROM dipping d WHERE SUBSTR(LOT_CODE, 9,4) = 'P28' AND (@t < @rqty); and i attach the sample output of the above query. Now that query test is work i will input that code to my php codes. $sql = "SELECT SKUCode, Materials, Comp, Qty FROM bom WHERE SKUCode = '$SKUCode'"; $res = mysql_query($sql, $con); ($row = mysql_fetch_assoc($res)); $Materials = $row['Materials']; $Qty = $row['Qty']; $Comp = $row['Comp']; //P28 //-----Compute Req Qty and Save to table---// $ReqQty = $Qty * $POReq; // 31968 $sql = "UPDATE bom SET ReqQty = '$ReqQty' WHERE SKUCode = '$SKUCode' AND Materials = '$Materials'"; $resReqQty = mysql_query($sql, $con); $t = 0; $sql = "SELECT LOT_CODE as code, DATE_ENTRY, CASE WHEN $t+OUTPUT_QTY > $ReqQty THEN $ReqQty -$t ELSE OUTPUT_QTY END as qty, $t := $t + d.OUTPUT_QTY as cumulative FROM dipping d WHERE SUBSTR(LOT_CODE, 9,4) = '$Comp' AND ($t < $ReqQty)"; when I echo the query: I got this: SELECT LOT_CODE as code, DATE_ENTRY, CASE WHEN 0+OUTPUT_QTY > 31968 THEN 31968 -0 ELSE OUTPUT_QTY END as qty, 0 := 0 + d.OUTPUT_QTY as cumulative FROM dipping d WHERE SUBSTR(LOT_CODE, 9,4) = 'P28' AND (0 < 31968) then I run it to the sql and I got an error: Error Code : 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 ':= 0 + d.OUTPUT_QTY as cumulative FROM dipping d WHERE SUBSTR(LOT_CODE, 9,4) = '' at line 1 (0 ms taken) Any help is highly appreciated Thank you so much Which of the below syntax is the better to be using? $bal = 100; if($bal > 100) { echo "you have over 100 pounds; } else { echo "you have less than 100 pounds"; } if ($bal > 100); echo "you have over than 100"; else ; echo "you have less than 100"; endif; The issue is there seems to be NO syntax error. 1. There is no relevant code before or after this line. 2. Yes, one would think a ! should be there as did I (I didn't write the code), however, even with the ! it still gives the same error. if (function_exists('gzcompress')) die(FUNCTION_NOT_FOUND); is giving me a syntax error, unexpected 'if', expecting 'function' or 'const' I am updating this code from PHP5.3 to PHP7.4 and I can't figure out what the syntax problem is since PHP allows this. I am using Eclipse PHP to do the conversion. Does anyone know what would cause this error: Notice: Undefined index: file in C:\Inetpub\wwwroot\Upload\uploader3.php on line 2 No file specified with these files for uploading images: uploader.htm <html><head><title>File Uploader</title></head> <body><h3>File Upload</h3> Select a file to upload:<br> <form action="uploader.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="45"> <br> <input type="submit" value="Upload File"> </form> </body></html> and, uploader.php <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:/Inetpub/wwwroot/Upload/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html> <head><title>Upload Complete</title></head> <body> <h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>"><img src="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>" height="200"></a> </body> </html> Thanks! i m facing this 2 errors in the below script
Notice: Undefined index: media in D:\server\website\htdocs\wefondyou\themes\grape\layout\story\content.phtml on line 107 Warning: Invalid argument supplied for foreach() in D:\server\website\htdocs\wefondyou\themes\grape\layout\story\content.phtml on line 107 I had tried add isset and is_array to line, the errors gone away, but image also gone away. any ideas?? <div id="story_<?php echo $sk['story']['id']; ?>" class="story-wrapper story_<?php echo $sk['story']['id']; ?>" data-story-id="<?php echo $sk['story']['id']; ?>"> <div class="publisher-wrapper"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="48px" align="left" valign="top"> <a href="<?php echo $sk['story']['publisher']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['publisher']['username']; ?>"> <img class="avatar" src="<?php echo $sk['story']['publisher']['thumbnail_url']; ?>" width="40px" height="40px" alt="<?php echo $sk['story']['publisher']['name']; ?>"> </a> </td> <td align="left" valign="top"> <a class="name" href="<?php echo $sk['story']['publisher']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['publisher']['username']; ?>"> <?php echo substr($sk['story']['publisher']['name'], 0, 35); ?> </a> <?php if ($sk['story']['recipient_exists'] == true) { ?> <i class="icon-arrow-right recipient-indicator-icon"></i> <a class="name" href="<?php echo $sk['story']['recipient']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['recipient']['username']; ?>"> <?php echo substr($sk['story']['recipient']['name'], 0, 35); ?> </a> <?php } echo $sk['story']['activity_text']; ?> <div class="other-data"> <span class="time-wrapper ajax-time" title="<?php echo date('c', $sk['story']['time']); ?>"> <?php echo date('c', $sk['story']['time']); ?> </span> <?php if ($sk['story']['location_exists'] == true) { ?> <abbr class="space3">·</abbr> <span class="location-wrapper" title="<?php echo $sk['story']['location']['name']; ?>"> <i class="icon-map-marker"></i> <?php echo $sk['story']['location']['name']; ?> </span> <?php } ?> </div> </td> </tr> </table> <?php if ($sk['logged'] == true) { ?> <div class="setting-buttons"> <?php if ($sk['story']['admin'] == true) { ?> <span class="remove-btn cursor-hand" title="<?php echo $lang['remove']; ?>" onclick="SK_deletePostWindow(<?php echo $sk['story']['id']; ?>);"> <i class="icon-remove progress-icon"></i> </span> <?php } elseif (!SK_isPostReported($sk['story']['id'])) { ?> <span class="report-btn cursor-hand" title="<?php echo $lang['report']; ?>" onclick="SK_reportPost(<?php echo $sk['story']['id']; ?>);"> <i class="icon-flag progress-icon"></i> </span> <?php } ?> </div> <?php } ?> </div> <?php if ($sk['logged'] == true) { ?> <div class="options-wrapper"> <?php echo SK_getPostLikeButton($sk['story']['id']); ?> <abbr class="space6">·</abbr> <?php echo SK_getPostShareButton($sk['story']['id']); ?> <abbr class="space6">·</abbr> <?php echo SK_getPostFollowButton($sk['story']['id']); ?> </div> <?php } if (!empty($sk['story']['text'])) { ?> <div class="text-wrapper"> <?php echo $sk['story']['text']; ?> </div> <?php } if ($sk['story']['media_exists'] == true) { // If it is photos if ($sk['story']['media_type'] == "photos") { ?> <div class="photos-wrapper"> <?php $photo_class = 'width-' . $sk['story']['media_num']; if ($sk['story']['media_num'] >= 3) { $photo_class = 'width-3'; } LINE HERE 107 -----> foreach ($sk['story']['media'] as $photo) { ?> <a href="javascript:void(0);"> <img class="<?php echo $photo_class; ?>" src="<?php echo $photo['url']; ?>" alt="Photo" onclick="javascript:SK_openLightbox(<?php echo $photo['post_id']; ?>);"> </a> <?php } ?> </div> <?php } elseif ($sk['story']['media_type'] == "soundcloud") { ?> <div class="soundcloud-wrapper" align="center"> <iframe frameborder="0" src="https://w.soundcloud.com/player/?url=<?php echo $sk['story']['media']['url']; ?>&color=f07b22" width="100%"></iframe> </div> <?php } elseif ($sk['story']['media_type'] == "youtube") { ?> <div class="youtube-wrapper" align="center"> <iframe src="https://www.youtube.com/embed/<?php echo $sk['story']['media']['id']; ?>?ap=%2526fmt%3D18&disablekb=1&rel=0" width="100%" height="300px" frameborder="0" allowfullscreen></iframe> </div> <?php } } elseif ($sk['story']['location_exists'] == true) { ?> <div class="google-map-viewer-wrapper" align="center"> <img src="http://maps.googleapis.com/maps/api/staticmap?center=<?php echo $sk['story']['location']['name']; ?>&zoom=13&size=600x300&maptype=roadmap&markers=color:red%7C<?php echo $sk['story']['location']['name']; ?>" width="100%" alt="<?php echo $sk['story']['location']['name']; ?>"> </div> <?php } ?> <div class="activity-wrapper"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="middle"> <span class="story-like-activity"> <?php echo SK_getPostLikeActivityButton($sk['story']['id']); ?> </span> <abbr class="space6">·</abbr> <span class="story-comment-activity"> <?php echo SK_getPostCommentActivityButton($sk['story']['id']); ?> </span> <abbr class="space6">·</abbr> <span class="story-share-activity"> <?php echo SK_getPostShareActivityButton($sk['story']['id']); ?> </span> </td> <td align="right" valign="middle"> <?php if ($sk['story']['via_type'] == "like") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo $sk['story']['via']['name']; ?> </a> <?php echo $lang['likes_this_label']; ?> <?php } elseif ($sk['story']['via_type'] == "share") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo $sk['story']['via']['name']; ?> </a> <?php echo $lang['shared_this_label']; ?> <?php } elseif ($sk['story']['via_type'] == "tag") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo substr($sk['story']['via']['name'], 0, 15); ?> </a> <?php echo $lang['tagged_on_this_label']; ?> <?php } ?> </td> </tr> </table> </div> <div class="comments-container hidden"> <?php if ($sk['story']['view_all_comments'] == true) { ?> <div class="view-more-wrapper" align="center" onclick="SK_loadAllComments(<?php echo $sk['story']['id']; ?>);"> <i class="icon-lightbulb progress-icon hide"></i> <?php echo $lang['view_all_comments_label']; ?> </div> <?php } ?> <div class="comments-wrapper"> <?php echo $sk['story']['comments']; ?> </div> <?php echo $sk['story']['comment']['publisher_box']; ?> </div> </div> Hi I'm in need of help with some errors that the admin page of my cms is spitting out, I'm very new to php but I'm great understanding directions so any help that anyone can provide will be greatly appreciated.
These are the errors being displayed:
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mysite/public_html/includes/joomla.php on line 437 Does anyone know of a function that I can use to get all occurring PHP errors during script execution into a string. Also, does anyone know what's wrong with php.net? It keeps saying service is down. i get this when i tried to retrive a venue id so admin can edit them Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Warning: session_start() [FUNCTION.SESSION-START]: Cannot send session cache limiter - headers already sent Code: [Select] <?php include 'scripts/connect.php'; if(isset($_GET['vid'])){ $query = mysql_query("SELECT * FORM venue"); while ($row = mysql_fetch_array($query)){ $id = $row['id']; $venuename = $row['venuename']; $address = $row['address']; $phone = $row['phone']; $vemail = $row['vemail']; $state = $row['state']; $town = $row['town']; $zip = $row['zip']; $seats = $row['seats']; } } ?> <?php require "header.php"; ?> The code below returns the correct results, which are in this case are email addresses. After each displayed value there is a br eg. emai1@hotmail.com<br>email2@hotmail.com<br>email3@ etc. So the quesion is, can i change the below codeing to prevent this. I have tried changing $message .= "<br>". $row['email'] to $message .= "\n". $row['email'] but this results in; Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html $code = $_GET['postcode']; $message = $_GET['message']; $emailad = "email@hotmail.co.uk"; $shortcode = substr($code,0,2); $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die(mysql_error()); echo "<h2>Business Names:</h2>"; while ($row = mysql_fetch_array( $result )) { $message .= "<br>". $row['email'] ; } echo "\n"; echo $message; mail( "$emailad", "Header","$message" ); echo "<br>" . "Thank you for using our mail form."; im getting following errors:
Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: property line 6 and xsl:for-each in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 25 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: for-each line 5 and property in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 26 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: xsltParseStylesheetProcess : empty stylesheet in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::transformToXml() [xsltprocessor.transformtoxml]: No stylesheet associated to this object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 16 Fatal error: Call to a member function saveXML() on a non-object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 18 the xslt file is as following: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/19...XSL/Transform"> <xsl:output method="xml" indent="yes"/> When I am trying to update a record in the database i get this error after I submit the form that is populated from the database. 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 'desc = 'SFR ANNOUNCES 3RD ANNUAL \"12 DAYS OF CHRISTMAS FOOD DRIVE\"', body = '<' at line 1 Hello. I am at beginning with php and now trying to make an ecommerce website. I know it's a bit stupid but it works until now. This site work perfect on localhost using xampp but then I transfered it to webhost, I get a lot of errors. |