PHP - Notice, Warning Is More..
Well hello studies?, Well I'm new to PHP was putting into practice what you learned during the school days and I'm having errors like these
Similar TutorialsHi,
I'm trying to read the 'code' value "2303" from the following XML.
This is currently held in a string called $result.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="x"> <response> <result code="2302"> <msg>Object exists</msg> <extValue> <value> <domain:name xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"> google.co.uk </domain:name> </value> <reason>V094 Domain name exists already</reason> </extValue> </result> <trID> <clTRID>ABC-1234x5</clTRID> <svTRID>387210698x9</svTRID> </trID> </response> </epp>I have the following, but it is throwing me an error. I cant figure out what I'm doing wrong, as thought i had referenced it correctly. $xml = simplexml_load_file($result); $code = intval($xml->response->result['code']); //line 147 echo $code;Notice: Trying to get property of non-object in class.php on line 147 Warning: simplexml_load_file(): I/O warning : failed to load external entity Any help much appreciated. MoFish Here is an example of the beginning of a rating system script: Code: [Select] // RATING SYSTEM - START if ((isset($array[0]) || isset($array[1])) && isset($_SESSION['user_id'])) { // check to see if user has already voted on given contribution $query = "SELECT * FROM votes WHERE con_id = '$array[2]' AND user_id = '$array[3]'"; $query_run = mysqli_query ($dbc, $query) or die (mysqli_error($dbc)); $num_rows = mysqli_num_rows ($query_run); $assoc = mysqli_fetch_assoc ($query_run); $rating = $assoc['rating']; // check to see if it's user's own contribution $query = "SELECT * FROM con WHERE con_id = '$array[2]'"; $query_run = mysqli_query ($dbc, $query) or die (mysqli_error ($dbc)); $assoc = mysqli_fetch_assoc ($query_run); $con_user_id = $assoc['user_id']; For every array variable I am getting the error message "Undefined Offset". Any ideas how to solve this one, I do not fully know yet what is common practice in these cases. The warnings also do not always happen, they usually happen, they happen in a specific moment when I use a drop down menu, to show table content. This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=323395.0 hi, I need help really badly for my PHP-Postcard Script. Basically it sends the card out but the URL does not work, I get the following error message: The URL is not valid and cannot be loaded It also states that Notice: Undefined index: www.voluntary.awardspace.co.uk in /home/www/voluntary.awardspace.co.uk/Postcard.php on line 25 Notice: Undefined index: Postcard.php in /home/www/voluntary.awardspace.co.uk/Postcard.php on line 25 See Code below: <?php session_start(); //check error log ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); // CHANGE PARAMETERS HERE BEGIN $senderName = " Holidays From Home "; // Eg.: John's Postcards $senderEmail = "chris01@voluntary.awardspace.co.uk"; // Eg.: john@postcard.com // Change only if you have problems with urls $postcardURL = "http://".$_SERVER["www.voluntary.awardspace.co.uk"].$_SERVER["Postcard.php"]; // CHANGE PARAMETERS HERE END $result = 0; $msg = ""; $msg1 = ""; $pic = ""; function displayPhotos() { global $pic; $columns = 5; $act = 0; $act1 = 0; // Open the actual directory if($handle = opendir("thumbs")) { // Read all file from the actual directory while($file = readdir($handle)) { if(!is_dir($file)) { if(isset($pic[1])) { if($pic[1] == $act1){$sel = "checked";} else{$sel = "unchecked";} } if($act == 0){echo "<tr>";} echo "<td align='center'><img src='thumbs/$file' alt='postcard'/><br/><input type='radio' name='selimg' value='$file,$act1' $sel/></td>"; $act++; $act1++; if($act == $columns){$act = 0;echo "</tr>";} } } echo "</tr>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Micro Postcard</title> <link href= "style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div class="style1" id="caption"> <div align="left" class="style1"></div> </div> <?php //makes sure form is correctly filled in if(!empty($_POST["submit"])) { if(empty($_POST["selimg"])){$msg = "Please select an image from above!";$result = 3;} else{$pic = explode(",",$_POST["selimg"]);} if(empty($_POST["email"]) && empty($result)){$msg1 = "You must enter an email address!";$result = 3;} $secCode = empty($_POST["secCode"]) ? "" : strtolower($_POST["secCode"]); if($secCode == $_SESSION["securityCode"] && $result != 3) { $filename = date("YmdGis"); $f = fopen("messages/".$filename.".txt","w+"); fwrite($f,$pic[0]."\n"); fwrite($f,$_POST['email']."\n"); fwrite($f,stripslashes($_POST["message"])."\n"); fclose($f); // Compose the mail $from = "From: $senderName <$senderEmail>\r\n"; $replay = "Reply-To: $senderEmail\r\n"; $params = "MIME-Version: 1.0\r\n"; $params .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $mailtext = "You have just received a Virtual Postcard!\r\n\r\n You can pick up your postcard at the following web address:\r\n $postcardURL?show=$filename\r\n\r\n We hope you enjoy your postcard, and if you do, please take a moment to send a few yourself!\r\n\r\n Regards,\r\n Holidays From Home\r\n $postcardURL"; // Send email @mail($_POST["email"],"You've received a postcard",$mailtext,$from.$replay.$params); echo "<center> Your postcard was sent successfully!<br /><br /> <img src='images/$pic[0]' alt='postcard' /><br /><br /><br />".stripslashes($_POST["message"]). "</center>"; $result = 1; } else{if($result != 3){$result = 2;}} } if(!empty($_GET["show"])) { $file = $_GET["show"]; $content = file("messages/$file.txt"); $pic = $content[0]; unset($content[0]); unset($content[1]); foreach($content as $value){$main .= $value;} echo "<center> Your postcard!<br /><br /> <img src='images/$pic' alt='postcard' /><br /><br /><br />$main </center>"; } if((empty($result) || $result == 2 || $result == 3) && empty($_GET["show"])) { echo "<form action='#' method='post'> <table align='center'>"; displayPhotos(); echo "</table> <div style='color:#f00;font-size:16px;'>$msg</div> <h2>Fill in the Form and then click on Send Card!!</h2> <table width='100%'> <tr><td>Send to (email address):</td><td><div style='color:#f00;font-size:16px;'>$msg1</div><input type='text' name='email' size='30' value='".$_POST["email"]."' /></td></tr> <tr><td>Message:</td><td><textarea name='message' rows='10' cols='40'>".stripslashes($_POST["message"])."</textarea></td></tr> <tr><td colspan='2'>".($result == 2 ? "<p style='color:#f00;font-size:16px;'>Sorry the security code is invalid! Please try it again!</span></p>" : " ")."</tr> <tr> <td>Security code: <input class='text' name='secCode' type='text' size='10' /> </td><td><img src='securityCode.php' alt='security code' border='1' /></td> </tr> <tr><td colspan='2'> </tr> <tr><td colspan='2' align='left'><input type='submit' value='Send card!' name='submit'/></td></tr> </table> </form>"; } ?> Absolutely any help would be much appreciated. I want ot know is there a way round this problem? Here is the http://voluntary.awardspace.co.uk/Postcard.php I am absolutely desperate to solve this burning issue Hi Everyone I am having a few issues with my website. I have developed in on my xampp local host and it works ok but when I upload the files and try to renew a membership using stripe I get the following messages. Warning: session_start(): Cannot start session when headers already sent in /customers/a/d/f/mywebsite.co.uk/httpd.www/mywebsite/inc/settings.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at /customers/a/d/f/mywebsite.co.uk/httpd.www/mywebsite/procedures/payments/charge.php:1) in /customers/a/d/f/mywebsite.co.uk/httpd.www/mywebsite/procedures/payments/charge.php on line 141 I have some includes that appear on every page. This is the bootstrap.php file. This file holds the settings.php which connects to my database and other function files. In this settings page I call the session_start() php function and then connect to my database. I call the bootstrap.php file on every page to there for call the session_start() on every page. I am using sessions alot so is this the right thing to do? I have attached the renew_membership payment page which holds the form. The user fills out the payment page and the form data gets sent to a script called charge.php which uses the stripe objects to make the payment. I then want to do a redirect to the paymentSuccess.php page to output to the user that the payment was made successfully. This is where the issues arrise. I have split the charge file into 3 screen shots so it is more readable. Hope someone can help me. Thanks a lot David
Edited April 26 by Irish_Dave <?php if(isset($_POST['submit'])){ $name = $_POST['name']; } ?> <form method="POST" action="hist1.php"> <br /> <input type="hidden" name="name" value="<?php echo $name ?>" /> <?php $q = mysql_query("SELECT * FROM histact1 ORDER BY RAND() LIMIT 1"); while ($r1 = mysql_fetch_array($q)){ $id = $r1[0]; $question1 = $r1[1]; $opt1 = $r1[3]; $opt2 = $r1[4]; $opt3 = $r1[5]; ?> <div class="Qset" id="q1"><br /><br /> <label class="items">1st Question :</label> <br /> <center> <textarea class="textareaQ" name="question1" readonly><?php echo $question1; ?></textarea> </center> <br /><br /> <p class="marA"> <input type="radio" name="rad1" value="<?php echo $opt1; ?>" /> <label class="lbl"><?php echo $opt1 ?></label><br /> <input type="radio" name="rad1" value="<?php echo $opt2; ?>" /> <label class="lbl"><?php echo $opt2 ?></label><br /> <input type="radio" name="rad1" value="<?php echo $opt3; ?>" /> <label class="lbl"><?php echo $opt3 ?></label><br /> </p> </div> <div class="lr"> <center> <br /><br /><br /><br /> <a class="nxt" href="#q2"><label title="Proceed to 2nd Question">Next</label></a> </center> </div> <br /><br /><br /> <center><hr width="90%" /></center><br /> <?php } ?> <br /><br /> <?php $q = mysql_query("SELECT * FROM histact1 ORDER BY RAND() LIMIT 1"); while ($r1 = mysql_fetch_array($q)){ $id = $r1[0]; $question2 = $r1[1]; $opt1 = $r1[3]; $opt2 = $r1[4]; $opt3 = $r1[5]; ?> <div class="Qset" id="q2"><br /><br /> <label class="items">2nd Question :</label> <br /> <center> <textarea class="textareaQ" name="q2" readonly><?php echo $question2; ?></textarea> </center> <br /><br /> <p class="marA"> <input type="radio" name="rad2" value="<?php echo $opt1; ?>" /> <label class="lbl"><?php echo $opt1 ?></label><br /> <input type="radio" name="rad2" value="<?php echo $opt2; ?>" /> <label class="lbl"><?php echo $opt2 ?></label><br /> <input type="radio" name="rad2" value="<?php echo $opt3; ?>" /> <label class="lbl"><?php echo $opt3 ?></label><br /> </p> </div> <div class="lr"> <center> <br /><br /><br /><br /> <a class="nxt" href="#q1"><label title="Proceed to 1st Question">Back</label></a> | <a class="nxt" href="#q3"><label title="Proceed to 3rd Question">Next</label></a> </center> </div> <br /><br /><br /> <center><hr width="90%" /></center><br /> <?php } ?> <br /><br /> <?php $q = mysql_query("SELECT * FROM histact1 ORDER BY RAND() LIMIT 1"); while ($r1 = mysql_fetch_array($q)){ $id = $r1[0]; $question3 = $r1[1]; $opt1 = $r1[3]; $opt2 = $r1[4]; $opt3 = $r1[5]; ?> <div class="Qset" id="q3"><br /><br /> <label class="items">3rd Question :</label> <br /> <center> <textarea class="textareaQ" name="q3" readonly><?php echo $question3; ?></textarea> </center> <br /><br /> <p class="marA"> <input type="radio" name="rad3" value="<?php echo $opt1; ?>" /> <label class="lbl"><?php echo $opt1 ?></label><br /> <input type="radio" name="rad3" value="<?php echo $opt2; ?>" /> <label class="lbl"><?php echo $opt2 ?></label><br /> <input type="radio" name="rad3" value="<?php echo $opt3; ?>" /> <label class="lbl"><?php echo $opt3 ?></label><br /> </p> </div> <div class="lr"> <center> <br /><br /><br /><br /> <a class="nxt" href="#q2"><label title="Proceed to 2nd Question">Back</label></a> | <a class="nxt" href="#q4"><label title="Proceed to 4th Question">Next</label></a> </center> </div> <br /><br /><br /> <center><hr width="90%" /></center><br /> <?php } ?> <br /><br /> <?php $q = mysql_query("SELECT * FROM histact1 ORDER BY RAND() LIMIT 1"); while ($r1 = mysql_fetch_array($q)){ $id = $r1[0]; $question4 = $r1[1]; $opt1 = $r1[3]; $opt2 = $r1[4]; $opt3 = $r1[5]; ?> <div class="Qset" id="q4"><br /><br /> <label class="items">4th Question :</label> <br /> <center> <textarea class="textareaQ" name="q4" readonly><?php echo $question4; ?></textarea> </center> <br /><br /> <p class="marA"> <input type="radio" name="rad4" value="<?php echo $opt1; ?>" /> <label class="lbl"><?php echo $opt1 ?></label><br /> <input type="radio" name="rad4" value="<?php echo $opt2; ?>" /> <label class="lbl"><?php echo $opt2 ?></label><br /> <input type="radio" name="rad4" value="<?php echo $opt3; ?>" /> <label class="lbl"><?php echo $opt3 ?></label><br /> </p> </div> <div class="lr"> <center> <br /><br /><br /><br /> <a class="nxt" href="#q3"><label title="Proceed to 3rd Question">Back</label></a> | <a class="nxt" href="#q5"><label title="Proceed to 5th Question">Next</label></a> </center> </div> <br /><br /><br /> <center><hr width="90%" /></center><br /> <?php } ?> <br /><br /> <?php $q = mysql_query("SELECT * FROM histact1 WHERE question != '$question1' AND question != '$question2' AND question != '$question3' AND question != '$question4' ORDER BY RAND() LIMIT 1"); while ($r1 = mysql_fetch_array($q)){ $id = $r1[0]; $question5 = $r1[1]; $opt1 = $r1[3]; $opt2 = $r1[4]; $opt3 = $r1[5]; ?> <div class="Qset" id="q5"><br /><br /> <label class="items">5th Question :</label> <br /> <center> <textarea class="textareaQ" name="q5" readonly><?php echo $question5; ?></textarea> </center> <br /><br /> <p class="marA"> <input type="radio" name="rad5" value="<?php echo $opt1; ?>" /> <label class="lbl"><?php echo $opt1 ?></label><br /> <input type="radio" name="rad5" value="<?php echo $opt2; ?>" /> <label class="lbl"><?php echo $opt2 ?></label><br /> <input type="radio" name="rad5" value="<?php echo $opt3; ?>" /> <label class="lbl"><?php echo $opt3 ?></label><br /> </p> </div> <div class="lr"> <center> <br /><br /><br /><br /> <a class="nxt" href="#q4"><label title="Proceed to 4th Question">Back</label></a> | <input type="submit" title="Submit Answers" name="submit" class="submit" value=" Submit " onclick="return confirm('Are you sure you want to submit your answers?\nYou can review your answer by click the Back link')" /> </center> </div> <br /><br /><br /> <center><hr width="90%" /></center><br /> <?php } ?> </form> Edited by mac_gyver, 09 October 2014 - 10:51 AM. code in code tags please I am running to an issue that I have never delt with before and am not sure if there is even a possible solution: I have two files: fileA and fileB fileA contains a loop that loops 30 times each time its called. in the loop there is a 2second delay $i = 1; do { $i++; sleep(2); if(!isset($_SESSION['user']) { break; } } while($i < 31); if fileB i have a simple destroy session $_SESSION = array(); session_destroy(); I call both files via ajax, and that is where i run into my problem. if I call fileA first, then call fileB through ajax, the code in FileB does not execute until fileA has run its course. Is it possible to get around this? Like set the priority of one over the other? So I am tryting to create a script to upload a CSV file into a MySql DB. It has like 10K records into SQL
My Code is copy below ...
I get the following errors.
Line 16 is the $handle
line 18 is the While Statement
Error:
Warning: fopen(): Filename cannot be empty in C:\local\htdocs\ADPStorage\DemandCSV.php on line 16 Warning: fopen()expects parameter 1 to be resource, boolean given in C:\local\htdocs\ADPStorage\DemandCSV.php on line 18 I use my script for another table and it worked like a charm. Less data and less colums do. Bad Code: (good Code sample below. this one) <?php $today = date("m.d.y.h.m.s"); echo $today; $BPTD_fy = '2014'; $BPTD_updatedate = $today; $conn = mysql_connect("Localhost","root","password") or die (mysql_error()); mysql_select_db("ds_storage",$conn); if(isset($_POST['submit'])) { $file = $_FILES['file']['tmp_name']; $handle = fopen($file, "r"); while(($fileop = fgetcsv($handle, 100000, ",")) !==FALSE) { $BPTD_fy = $fileop[0]; $BPTD_Status = $fileop[1]; $BPTD_Classification = $fileop[2]; $BPTD_ProcureCat = $fileop[3]; $BPTD_Product = $fileop[4]; $BPTD_Project = $fileop[5]; $BPTD_DSCategory = $fileop[6]; $BPTD_Calculated = $fileop[7]; $BPTD_CapacityType = $fileop[8]; $BPTD_Amount = $fileop[9]; $BPTD_Jul = $fileop[10]; $BPTD_Aug = $fileop[11]; $BPTD_Sep = $fileop[12]; $BPTD_Oct = $fileop[13]; $BPTD_Nov = $fileop[14]; $BPTD_Dec = $fileop[15]; $BPTD_Jan = $fileop[16]; $BPTD_Feb = $fileop[17]; $BPTD_Mar = $fileop[18]; $BPTD_Apr = $fileop[19]; $BPTD_May = $fileop[20]; $BPTD_Jun = $fileop[21]; $BPTD_Location = $fileop[22]; $BPTD_Env = $fileop[23]; $BPTD_Requester = $fileop[24]; $BPTD_ServiceArea = $fileop[25]; $BPTD_ServiceGroup = $fileop[26]; $BPTD_DepHead = $fileop[27]; $BPTD_Recgroup = $fileop[28]; $BPTD_RecOwner = $fileop[29]; $BPTD_Entrydate = $fileop[30]; $BPTD_updatedate = $fileop[31]; $sql = mysql_query("INSERT INTO inv_bpt_demand (Status, Classification, ProcureCat, Product, Project, DSCategory, Calculated, CapacityType, Amount, Jul, Aug, Sep, Oct, Nov, Dec, Jan, Feb, Mar, Apr, May, Jun, Location, Env, Requester, ServiceArea, ServiceGroup, DepHead, Recgroup, RecOwner, Entrydate, updatedate) VALUES ('$BPTD_Status', '$BPTD_Classification', '$BPTD_ProcureCat', '$BPTD_Product', '$BPTD_Project', '$BPTD_DSCategory', '$BPTD_Calculated', '$BPTD_CapacityType', '$BPTD_Amount', '$BPTD_Jul', '$BPTD_Aug', '$BPTD_Sep', '$BPTD_Oct', '$BPTD_Nov', '$BPTD_Dec', '$BPTD_Jan', '$BPTD_Feb', '$BPTD_Mar', '$BPTD_Apr','$BPTD_May', '$BPTD_Jun','$BPTD_Location', '$BPTD_Env','$BPTD_Requester', '$BPTD_ServiceArea', '$BPTD_ServiceGroup','$BPTD_DepHead', '$BPTD_Recgroup','$BPTD_RecOwner','$BPTD_Entrydate','$BPTD_updatedate')"); if($sql) { echo 'Data Uploaded Successfully'; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>BPT Demand CSV</title> <link rel="stylesheet" type="text/css" href="file:///C|/local/htdocs/style/style.css" /> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> </head> <body> <div id="mainWrapper"> <form method="post" action="https://localhost/Storage/DemandCSV.php" enctype="multipart/form-data"> <input type="file" name="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div><!--end mainWrapper--> </body> </html>Similar Working code (good) <?php $conn = mysql_connect("Localhost","root","password") or die (mysql_error()); mysql_select_db("ds_storage",$conn); if(isset($_POST['submit'])) { $file = $_FILES['file']['tmp_name']; $handle = fopen($file, "r"); while(($fileop = fgetcsv($handle,1000,",")) !==FALSE) { $PC_Num = $fileop[0]; $PC_Name = $fileop[1]; $PC_BPTNUM = $fileop[2]; $PC_busclass = $fileop[3]; $PC_Note = $fileop[4]; $PC_Acro = $fileop[5]; $PC_type = $fileop[6]; ///echo $fileop[1]; $sql = mysql_query("INSERT INTO inv_names (PC_Num, PC_Name, PC_BPTNUM, PC_busclass, PC_Note, PC_Acro, PC_type) VALUES ('$PC_Num', '$PC_Name', '$PC_BPTNUM', '$PC_busclass', '$PC_Note', '$PC_Acro', '$PC_type')"); if($sql) { echo 'Data Uploaded Successfully'; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Upload CSV</title> <link rel="stylesheet" type="text/css" href="file:///C|/local/htdocs/style/style.css" /> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> </head> <body> <div id="mainWrapper"> <form method="post" action="https://localhost/Storage/Storage_CSV.php" enctype="multipart/form-data"> <input type="file" name="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div><!--end mainWrapper--> </body> </html>Please help and thx in advance ~J Hey I updated my WAMP server the other day and I am getting al of these Errors now. Notice: Undefined variable: ac in C:\wamp\www\xxxxx\newupdates.php on line 15 And there is about 25 of them on one page, and they are all over the place. Undoubtly it is my poor coding, but how come it never showed up before, and the site itself still works. Any help would be great, I basically wont to get rid of these while i am coding to find text between some html tags ,, am getting an error... Notice: Undefined offset: 1 in D:\xamp\xampp\htdocs\file\dash.php on line 48 my code is at line 47 and 48 is Code: [Select] preg_match('/<td class="trow1" rowspan="3" valign="top">(.*)<\/td> /',$dat,$regs); echo $etc=$regs[1]; i am thinking copy data from Code: [Select] </td> <td class="trow1" rowspan="3" valign="top"> Posts per day: <strong>6.03</strong><br /> Threads per day: <strong>3.78</strong><br /> Members per day: <strong>4.76</strong><br /> Posts per member: <strong>1.27</strong><br /> Replies per thread: <strong>0.6</strong> </td> </tr> this much Code: [Select] Posts per day: <strong>6.03</strong><br /> Threads per day: <strong>3.78</strong><br /> Members per day: <strong>4.76</strong><br /> Posts per member: <strong>1.27</strong><br /> Replies per thread: <strong>0.6</strong> Can you set php to header("Location: http://www.yoursiteshomepage.com"); if you encounter a php error or notice? I encountered one just now. i have no idea what i did and didn't fix or alter anything but i can't seem to recreate it to figure out what happenned. Just thinking about when i make my site live. I am trying to use absolute path across my project excluding the domain as of now and I am trying to do it as follows: Code: [Select] define('root', '/php_projects/myproject/'); // The Standard Data $path = "path.php"; $connectvars = "connectvars.php"; // The CSS Styles $reset_css = root . "view/reset.css"; $style_css = root . "view/style.css"; This works so far, the only problem I am having is that it is producing a notice. And my question is, how can I get rid of the notice? The notice is this one: Code: [Select] Notice: Constant root already defined in C:\xampp\htdocs\php_projects\myproject\path.php on line 3 Why does the notice get produced in first place? I never defined it twice, as it states. Google has failed me once again . I'm getting this error, which I can't find out how to fix: Here's the code: $Database_Factions = "factions"; $Database_Factions_1 = "Name"; $Database_FName_Num = 1; $searchmemberdata = mysql_query("SELECT " . $Database_Factions_1 . " FROM " . $Database_Factions . " WHERE " . $Database_Factions_1 . " LIKE '" . mysql_real_escape_string($_GET['name']) . "%' LIMIT 1"); $searchdata = mysql_fetch_row($searchmemberdata); echo($searchdata[$Database_FName_Num]); echo("<meta http-equiv='refresh' content='55;url=member.php?action=ViewFaction&name=" . $searchdata[$Database_FName_Num] . "' />"); I know my code is not optimized, I'm fixing it after i'm done with what i'm doing. Everytime $searchdata[$Database_FName_Num] is called, the error: Notice: Undefined offset: 1 comes out. Any help? I have a form and a validation both on the same page, however I'm getting notices since I have undefined variables. How do I get around this? Notice: Undefined index: submit in C:\xampp\htdocs\5dollar\register.php on line 10 Notice: Undefined index: password in C:\xampp\htdocs\5dollar\register.php on line 12 Notice: Undefined index: repeatpassword in C:\xampp\htdocs\5dollar\register.php on line 13 Notice: Undefined index: paypalemail in C:\xampp\htdocs\5dollar\register.php on line 14 $submit = $_POST['submit']; $password = strip_tags($_POST['password']); $repeatpassword = strip_tags($_POST['repeatpassword']); $paypalemail = strip_tags($_POST['paypalemail']); I'm getting the following notice: Notice: Undefined variable: TotaalBerichten in C:\Users\Sander\Documents\**********************\index.php on line 60 Is it because it is in the IF? The code: //Aantal berichten totaal if (!$ResultTotaalBerichten = @mysql_query("SELECT COUNT(1) FROM " . $db_prefix . "berichten")) {$foutmelding .= $Taal['errorConfiguratieFromDB'];} else {$TotaalBerichten = mysql_result($ResultTotaalBerichten, 0); $TotaalPaginas = ceil($TotaalBerichten / $aantalBerichtenPerPagina);} @mysql_free_result($ResultTotaalBerichten); //Var eersteBericht is het eerste bericht if (isset($_GET['eersteBericht'])) {if (!is_numeric($_GET['eersteBericht'])) {$eersteBericht = '0';} else{$eersteBericht = $_GET['eersteBericht'];}} else{$eersteBericht = '0';} // Als er iets mis is met var eersteBericht, dan hem op 0 zetten if (($eersteBericht >= $TotaalBerichten) || ($eersteBericht < 0)) ///////////DIT IS LIJN 60 {$eersteBericht = 0;} EDIT: translated to english If i modify it to: $TotaalBerichten=0; /////////////ADDED //Aantal berichten totaal if (!$ResultTotaalBerichten = @mysql_query("SELECT COUNT(1) FROM " . $db_prefix . "berichten")) {$foutmelding .= $Taal['errorConfiguratieFromDB'];} else {$TotaalBerichten = mysql_result($ResultTotaalBerichten, 0); $TotaalPaginas = ceil($TotaalBerichten / $aantalBerichtenPerPagina);} @mysql_free_result($ResultTotaalBerichten); echo $TotaalBerichten; //////////////////////////////////////////////////////////////////////////ADDED //Var eersteBericht is het eerste bericht if (isset($_GET['eersteBericht'])) {if (!is_numeric($_GET['eersteBericht'])) {$eersteBericht = '0';} else{$eersteBericht = $_GET['eersteBericht'];}} else{$eersteBericht = '0';} // Als er iets mis is met var eersteBericht, dan hem op 0 zetten if (($eersteBericht >= $TotaalBerichten) || ($eersteBericht < 0)) ///////////DIT IS LIJN 60 {$eersteBericht = 0;} The $TotaalBerichten is '0' while there IS a message in the database??? I realize others have had problems with the undefined index issue, but I can't find any answer to my particular problem in any forum, anywhere. I have a form/script which uploads images with description for an artist site. There are 25 images available to upload (an artist profile image and 24 art images), and the images 1-19 upload just fine. All the images share exactly the same code. But when the processing script comes to image 20, it fails and I get the "undefined index" notice. Here is the processing code for image 19-20. Code: [Select] //There are a total of 20 other blocks of code above this one, //and they are all the same except for the image number. //Artimage19 Process Begin $artimage19 = $_FILES['artimage19']['name']; $file_size = $_FILES['artimage19']['size']; $file_temp = $_FILES['artimage19']['tmp_name']; $title19 = $_POST['title19']; $disptitle19 = stripslashes($title19); $medium19 = $_POST['medium19']; $dim19 = $_POST['dim19']; $price19 = $_POST['price19']; $file_basename = substr($artimage19, 0, strripos($artimage19, '.')); // strip extention $file_ext = substr($artimage19, strripos($artimage19, '.')); $allowed_extensions['ext']= array('jpeg','jpg','gif','png'); if(!$allowed_extensions){ echo "Artimage19 file extension not allowed."; }else{ $file_ext = strtolower($file_ext); $random = rand(0000, 9999); $new_file_name19 = $surname.$random. '.' .$file_ext; } if($file_size > MAX_SIZE*1024) { echo 'ARTIMAGE19 FILE SIZE TO LARGE<BR />'; } if(move_uploaded_file($file_temp, "$filepath/$new_file_name19")) { //echo '<h3>Upload Successful!</h3>'; } else { echo '<h3>ERROR IN UPLOADING ARTIMAGE19</h3>'; } //Artimage19 Process Ends //Artimage20 Process Begin $artimage20 = $_FILES['artimage20']['name']; $file_size = $_FILES['artimage20']['size']; $file_temp = $_FILES['artimage20']['tmp_name']; $title20 = $_POST['title20']; $disptitle20 = stripslashes($title20); $medium20 = $_POST['medium20']; $dim20 = $_POST['dim20']; $price20 = $_POST['price20']; $file_basename = substr($artimage20, 0, strripos($artimage20, '.')); // strip extention $file_ext = substr($artimage20, strripos($artimage20, '.')); $allowed_extensions['ext']= array('jpeg','jpg','gif','png'); if(!$allowed_extensions){ echo "Artimage20 file extension not allowed."; }else{ $file_ext = strtolower($file_ext); $random = rand(0000, 9999); $new_file_name20 = $surname.$random. '.' .$file_ext; } if($file_size > MAX_SIZE*1024) { echo 'ARTIMAGE20 FILE SIZE TO LARGE<BR />'; } if(move_uploaded_file($file_temp, "$filepath/$new_file_name20")) { //echo '<h3>Upload Successful!</h3>'; } else { echo '<h3>ERROR IN UPLOADING ARTIMAGE20</h3>'; } //Artimage20 Process Ends Artimage19 uploads just fine, but Artimage20 fails. The $filepath is set correctly, as it uploads all previous image files. The code for the submitting code is fine also. Here is the code that submits the data. Code: [Select] //The form header is below <form action="pdregisterres.php" method="POST" enctype="multipart/form-data" onSubmit="return checkrequired(this)"> //there are 18 others above this plus one for an artist profile image <tr><td colspan = "2"><hr></td></tr> <tr><td align = "left">Art Image 19:</td><td align = "left"><input type = "file" name = "artimage19"></td></tr> <tr><td align = "left">Title:</td><td align = "left"><input type = "text" name = "title19"></td></tr> <tr><td align = "left">Medium:</td><td align = "left"><input type = "text" name = "medium19"></td></tr> <tr><td align = "left">Dimensions:</td><td align = "left"><input type = "text" name = "dim19"></td></tr> <tr><td align = "left">Price:</td><td align = "left"><input type = "text" name = "price19"></td></tr> <tr><td colspan = "2"><hr></td></tr> <tr><td align = "left">Art Image 20:</td><td align = "left"><input type = "file" name = "artimage20"></td></tr> <tr><td align = "left">Title:</td><td align = "left"><input type = "text" name = "title20"></td></tr> <tr><td align = "left">Medium:</td><td align = "left"><input type = "text" name = "medium20"></td></tr> <tr><td align = "left">Dimensions:</td><td align = "left"><input type = "text" name = "dim20"></td></tr> <tr><td align = "left">Price:</td><td align = "left"><input type = "text" name = "price20"></td></tr> For some reason that I can't get, the form stops processing after Artimage19 and gives me this: Notice: Undefined index: artimage20 in /home/www/artistsofeureka.info/members/pdregisterres.php on line 1046 I also get the error message: ERROR IN UPLOADING ARTIMAGE20 I get this for images 20-24. Since the code for all image processing is exactly the same (except for image #), I can't see why it stops at #19. These images are being uploaded to a folder on my server and a mysql db. Images up to #19 upload just fine. Any comments, questions or helpful advice? I don't know why I am getting an undefined variable when the url is define. look at the deleteid=6 it means it is defined and in the code it is written as below URL Quote http://www.ppp.com/storeprueba/storeadmin/inventory_list.php?deleteid=6 Code: [Select] <?php if(isset($_GET['deleteid'])){ //which is clearly active in the url then get it, /* line 27 ===> */ echo'Do you really want to delete pdoruct with ID of '. $GET ['deleteid'] . '? <a href="inventory_list.php?yesdelete=' . $GET ['deleteid'] . '">Yes</a> |<a href="inventory_list.php"> No</a>'; exit(); } if (isset($_GET['yesdelete'])) { // remove item from system and delete its picture // delete from database $id_to_delete = $_GET['yesdelete']; $sql = mysql_query("DELETE FROM products WHERE id='$id_to_delete' LIMIT 1") or die (mysql_error()); // unlink the image from server // Remove The Pic ------------------------------------------- $pictodelete = ("../inventory_images/$id_to_delete.jpg"); if (file_exists($pictodelete)) { unlink($pictodelete); } header("location:inventory_list.php"); exit(); } ?> the echo Code: [Select] <?php echo 'Do you really want to delete pdoruct with ID of '. $GET ['deleteid'] . '? <a href="inventory_list.php?yesdelete=' . $GET ['deleteid'] . '">Yes</a> |<a href="inventory_list.php"> No</a>'; ?> won't display the . $GET ['deleteid'] . after "Do you really want to delete product with ID of which is 6 but it won't display the number six with the actual configuration, instead it display it like Quote Notice: Undefined variable: GET in /home3/nyhungry/public_html/storeprueba/storeadmin/inventory_list.php on line 27 Notice: Undefined variable: GET in /home3/nyhungry/public_html/storeprueba/storeadmin/inventory_list.php on line 27 Do you really want to delete pdoruct with ID of ? Yes | No Notice not number in between 'ID of' and '?' Hi, I was wondering if someone can help me, I keep getting these errors. Notice: Undefined property: stdClass::$vOptionType in /default/commonFunctions.php on line 267 That is the line from the file. if($rsOptions[$j]->vOptionType=='colour_fromcsv' || $rsOptions[$j]->vOptionType=='size_fromcsv') I was wondering if someone could tell me what it means and possible point me in the right direction on how to fix the issue. Thanks, Jordan This code seems to work fine in older versions of PHP, but in newer.. I get an error message... Code: [Select] $tagArray = $temp = array(); $temp = explode(',', $words); foreach($temp as $tag){ $tagArray[trim($tag)]++; } The error message is: "Notice: Undefined index: 1..." I assume I can just turn off the error reporting, but I'd really rather fix the problem. Does anyone know what's going on? Thank you. I am trying to run a count query and faced with the error: Notice: Trying to get property of non-object in Not sure how to resolve this error in these lines:
if($result->num_rows > 0){ while($row = $result->fetch_rows()){ Code: <?php $sql = "SELECT Form_Group COUNT(Presence LIKE '/') AS Present, COUNT(Presence LIKE 'N') AS Absent, FROM 'attendance'"; $result = $conn->query($sql); ?> <?php //Fetch Data form database if($result->num_rows > 0){ while($row = $result->fetch_rows()){ ?> <tr> <td><?php echo $row['Form_Group']; ?></td> <td><?php echo $row['Present']; ?></td> <td><?php echo $row['Absent']; ?></td> </tr> <?php } } else { ?> <tr> <th colspan="6">There's No data found!!!</th> </tr> <?php } ?>
|