PHP - Why Is My Numbering Suddenly Skipping In My Php, Mysql Application
We have a php application that is just a form, that takes in data to a mysql database and then displays that data in queue(php web page) for the client. It has been working for the past 5 or more years. Six weeks ago, the client noticed that the numbering started skipping a number each time a request was entered. It then seemed to stop, now it has started again. See attached image.
Some detail he after user has completed web form and hits submit, three fields are populated in the mysql "REQUEST" table, then the actually data from the submitted web form is sent to the ANSWER table. The REQUEST table is in sync and is always populated, and numbering is in sequence but upon submit, the actual data from the request does NOT always go to the ANSWER table hence the "skipping of numbers." What do I even begin looking at/for to determine what happened? Reminder: this is a 5+ year old app that worked fine until maybe 6 weeks ago. No changes have been made to the database or the code base since 2008. The code that adds the data to the ANSWER table [the one that appears to skip] is below. The applicate is in php 4.3.1, mysql 5, linux server. Similar TutorialsHello Everyone So i have this script that pulls some stuff out of a db and displays it. Pretty basic. It used to work fine but now it omits one entry from the table. It always shows one less than its supposed to. I.E. if there are 4 table entries, it only shows 3. It didnt do this before and I'm not sure why it changed. I didnt edit the code at all. Here it is: Code: [Select] else{ $sql = "SELECT * FROM article WHERE lang='" . $validlang ."' AND cat_id=" . $validentry . " ORDER BY id DESC LIMIT 5"; $result = mysql_query($sql); if(!$result){ echo "Error querying the database." . mysql_error(); exit; } else{ $row = mysql_fetch_assoc($result); } if(!$row){ echo "Error: No articles found." . mysql_error(); exit; } else{ echo "<div id='section'>Organization News</div>"; while($row = mysql_fetch_assoc($result)){ echo "<h3><a href='" . $validlang . "/" . $row['location'] . "'>" . $row['title'] . "</a></h3>"; echo "<div id='subtitle'>" . $row['summary'] . "</div>"; } } } Any help would be appreciated. Thanks I have a script that uploads and images, creates 2 versions of it, re-sizes the images and inserts all the info into a DB. The odd thing is that if I don't have an image to upload, it will still run the script but it will completely skip over the description. If I upload an image, it works fine. Not too sure what the issue is. Is it because my variable of $desc causing a conflict? Here's my code: Code: [Select] <?php ini_set("display_errors",1); include 'dbconn.php'; $change=""; $abc=""; define ("MAX_SIZE"," 10000"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if($_SERVER["REQUEST_METHOD"] == "POST") { $image =$_FILES["file"]["name"]; $uploadedfile = $_FILES['file']['tmp_name']; if ($image) { $filename = stripslashes($_FILES['file']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { $change='<div class="msgdiv">Unknown Image extension </div> '; $errors=1; } else { $size=filesize($_FILES['file']['tmp_name']); if ($size > MAX_SIZE*1024) { $change='<div class="msgdiv">You have exceeded the size limit!</div> '; $errors=1; } if($extension=="jpg" || $extension=="jpeg" ) { $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); } else if($extension=="png") { $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } echo $scr; list($width,$height)=getimagesize($uploadedfile); $newwidth=150; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); $newwidth1=50; $newheight1=($height/$width)*$newwidth1; $tmp1=imagecreatetruecolor($newwidth1,$newheight1); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height); $famname = $_POST['famname']; $desc = $_POST['description']; $petname = $_POST['petname']; $letter = $_POST['letter']; $filename = "images/". $_FILES['file']['name']; $filename1 = "images/small". $_FILES['file']['name']; imagejpeg($tmp,$filename,100); imagejpeg($tmp1,$filename1,100); imagedestroy($src); imagedestroy($tmp); imagedestroy($tmp1); }} } //If no errors registred, print the success message if(isset($_POST['Submit']) && !$errors) { $insert="insert ignore into tbl_tribue (petname,familyname,letter,description,imgpath,thumbpath) values ('$petname','$famname','$letter','$desc','$filename','$filename1')"; mysql_query($insert); //mysql_query("update gallery set imgpath='$filename'"); $change=' <div class="msgdiv">Pet Added Successfully!</div>'; print $insert; } ?> I had turned on the error and the print to see the output. Anyone have any ideas? Thanks! I am new to PHP. I have been trying to do some research online for a few days and not getting very far. I feel like I know less now than I did before I started. Here's the story: I've set up a LAMP server that runs a Wiki and AppGini (http://www.bigprof.com/appgini/) - AppGini allows you to "Create web database applications instantly without writing any code" - The only downside we have with it, is it's got it's own set of user accounts. My team all logs in with the default admin account which isn't a big deal but we'd prefer to use LDAP to AD for reasons I won't get into right now. I emailed AppGini support and asked about LDAP integration. Their response was that it's "a little bit of work" and "You can modify the login authentication function to authenticate using LDAP ... please see the example code he http://code.activestate.com/recipes/101525-ldap-authentication/ (needs some modifications to work with AppGini)" I've googled around and found 2 dozen different LDAP PHP samples. I've gotten some of them to work. By work I mean they connect to my domain controller and say "success" I'm not actually logged into anything. So I'm looking for a little help from square one. I need to have a better understanding of how things are supposed to work so I know where I'm supposed to go with all of this. Where do I start? What do I do? What would YOU do? This is the current "index.php" that logs you into the site. Code: [Select] <?php error_reporting(E_ALL ^ E_NOTICE); $d=dirname(__FILE__); include("$d/defaultLang.php"); include("$d/language.php"); include("$d/incCommon.php"); $x->TableTitle=$Translation['homepage']; include("$d/header.php"); if($_GET['signOut']==1){ logOutMember(); } $tablesPerRow=2; $arrTables=getTableList(); ?> <div align="center"><table cellpadding="8"> <?php if($_GET['loginFailed']==1 || $_GET['signIn']==1){ ?> <tr><td colspan="2" align="center"> <?php if($_GET['loginFailed']){ ?> <div class="Error"><?php echo $Translation['login failed']; ?></div> <?php } ?> <form method="post" action="index.php"> <table border="0" cellspacing="1" cellpadding="4" align="center"> <tr> <td colspan="2" class="TableHeader"> <div class="TableTitle"><?php echo $Translation['sign in here']; ?></div> </td> </tr> <tr> <td align="right" class="TableHeader"> <?php echo $Translation['username']; ?> </td> <td align="left" class="TableBody"> <input type="text" name="username" value="" size="20" class="TextBox"> </td> </tr> <tr> <td align="right" class="TableHeader"> <?php echo $Translation['password']; ?> </td> <td align="left" class="TableBody"> <input type="password" name="password" value="" size="20"class="TextBox"> </td> </tr> <tr> <td colspan="2" align="right" class="TableHeader"> <span style="margin: 0 20px;"><input type="checkbox" name="rememberMe" id="rememberMe" value="1"> <label for="rememberMe"><?php echo $Translation['remember me']; ?></label></span> <input type="submit" name="signIn" value="<?php echo $Translation['sign in']; ?>"> </td> </tr> <tr> <td colspan="2" align="left" class="TableHeader"> <?php echo $Translation['go to signup']; ?> <br /><br /> </td> </tr> <tr> <td colspan="2" align="left" class="TableHeader"> <?php echo $Translation['forgot password']; ?> <br /><br /> </td> </tr> <tr> <td colspan="2" align="left" class="TableHeader"> <?php echo $Translation['browse as guest']; ?> <br /><br /> </td> </tr> </table> </form> <script>document.getElementsByName('username')[0].focus();</script> </td></tr> <?php } ?> <?php if(!$_GET['signIn'] && !$_GET['loginFailed']){ if(is_array($arrTables)){ if(getLoggedAdmin()){ ?><tr><td colspan="<?php echo ($tablesPerRow*3-1); ?>" class="TableTitle" style="text-align: center;"><a href="admin/"><img src=table.gif border=0 align="top"></a> <a href="admin/" class="TableTitle" style="color: red;"><?php echo $Translation['admin area']; ?></a><br /><br /></td></tr><?php } $i=0; foreach($arrTables as $tn=>$tc){ $tChk=array_search($tn, array()); if($tChk!==false && $tChk!==null){ $searchFirst='?Filter_x=1'; }else{ $searchFirst=''; } if(!$i % $tablesPerRow){ echo '<tr>'; } ?><td valign="top"><a href=<?php echo $tn; ?>_view.php<?php echo $searchFirst; ?>><img src=<?php echo $tc[2];?> border=0></a></td><td valign="top" align="left"><a href=<?php echo $tn; ?>_view.php<?php echo $searchFirst; ?> class="TableTitle"><?php echo $tc[0]; ?></a><br /><?php echo $tc[1]; ?></td><?php if($i % $tablesPerRow == ($tablesPerRow - 1)){ echo '</tr>'; }else{ echo '<td width="50"> </td>'; } $i++; } }else{ ?><tr><td><div class="Error"><?php echo $Translation['no table access']; ?><script language="javaScript">setInterval("window.location='index.php?signOut=1'", 2000);</script></div></td></tr><?php } } ?> </table><br /><br /><div class="TableFooter"><b><a href=http://bigprof.com/appgini/>BigProf Software</a> - <?php echo $Translation['powered by']; ?> AppGini 4.61</b></div> </div> </html> Hi, I need a small help. Here is my situation. I am using a MVC application (e.g. Joomla or Drupal) which has a .htaccess redirect rule that all requests are passed through index.php file. That's normal and this is my main application. Now I installed another application within the application folder structure. What I want do do here is to allow opening the third party application URLs after one logged into my main application. Can anybody provide me some pointers to do the same? Please let me know if you need any further information on this. Any solution irrespective of framework will work. Thanks! Anupam I am writing a small program that generates a sequential numbering array. I need to include potentially a prefix, leading zeros, a starting number, a suffix and a quantity and also reverse the generated values. example: P-000299-001 P-000298-001 P-000297-001 P-000296-001 P-000295-001 P-000294-001 P-000293-001 P-000292-001 P-000291-001 P-000290-001 P-000289-001 Here is my code to generate: <?php $quantity = "100"; $start = "200"; $leadingzeros = "000"; $prefix = "P-"; $suffix = "-001"; $i = $start + $quantity - 1; while ($i >= $start) { echo $prefix . $leadingzeros . $i-- . $suffix . "<br />\n"; } ?> The code all seem to function correctly until I increase the quantity to say 25000 numbers to be generated or if the number string gets too long and the server will just sit and spin until a "cannot be displayed error" appears in IE. It had been suggested to abandone the array and simply write the generated sequence to a file and this is the code to generated the file it - it really works great and is really fast. <?php $startTime = time(); // this is just for measuring execution time $quantity = "25000"; $start = "26000"; $length = 6; $prefix = "P-"; $suffix = "-001"; $file = "test.txt"; $fh = fopen($file, 'w') or die("Could not open $file for writing"); for($ix = 1, $nbr = $start; $ix <= $quantity; $ix++, $nbr--) { fprintf($fh, $prefix.'%0'.$length.'d'.$suffix."\n", $nbr); } // all done, let's see how long it took: $endTime = time(); echo "Script took about " . ($endTime - $startTime) . " seconds to run."; ?> I am using this program to generate numbering files used in the printing industry. The sequential numbering works great. I had to change your code slightly in order to produce a usable numbering file, I had to subtract "1" from the $start+$quantity in order to get the correct amount of numbers. For a start of 1000 and quantity of 10 you had 1010 as your first number and it should actually be 1009 to give you 10 numbers. $fh = fopen($file, 'w') or die("Could not open $file for writing"); for($ix = 1, $nbr = $start+$quantity-1; $ix <= $quantity; $ix++, $nbr--) P-001009-001 P-001008-001 P-001007-001 P-001006-001 P-001005-001 P-001004-001 P-001003-001 P-001002-001 P-001001-001 P-001000-001 Let's think of this as an 8.5" x 11" piece of paper going through a laser printer - if each page had one number on it the sequential number will be great. Anyway, here is the next challenge: Let's say we have one 5.5" x 8.5" on an 8.5" x 11" sheet twice or two up. Each with its own number on the left and right side of the paper. That after printing will be cut and stacked on top of one another and produce a pile that is still in the right order. We need to take the $quantity+$start-1 and divide by 2 and then interleave the two sets of numbers and stop the numbering set at the starting number. easy huh!!! P-001009-001 P-001004-001 P-001008-001 P-001003-001 P-001007-001 P-001002-001 P-001006-001 P-001001-001 P-001005-001 P-001000-001 Here is the code I have for an example: <?php $quantity = "10"; $start = "1000"; $leadingzeros = "00"; $prefix = "P-"; $suffix = "-001"; $i = $start + $quantity - 1; $quantity2 = $quantity / 2; $j = (int)($i - $quantity2); while ($j >= $start) { echo $prefix . $leadingzeros . $i-- . $suffix ."<br />\n" . $prefix . $leadingzeros . $j-- . $suffix . "<br />\n"; } ?> The third option is two completely different 5.5" x 8.5" items and two different numbering schemes on an 8.5" x 11" piece of paper. Here is the code I have been using for it. <?php $quantity = "10"; $start = "1000"; $leadingzeros = "00"; $prefix = "P-"; $suffix = "-001"; $quantity2 = "10"; $start2 = "2000"; $leadingzeros2 = "000"; $prefix2 = "Q-"; $suffix2 = "-005"; $i = $start + $quantity - 1; $k = $start2 + $quantity2 - 1; while ($i >= $start) { echo $prefix . $leadingzeros . $i-- . $suffix . "<br />\n" .$prefix2. $leadingzeros2 . $k-- . $suffix2 . "<br />\n"; } ?> Which produces: P-001009-001 Q-0002009-005 P-001008-001 Q-0002008-005 P-001007-001 Q-0002007-005 P-001006-001 Q-0002006-005 P-001005-001 Q-0002005-005 P-001004-001 Q-0002004-005 P-001003-001 Q-0002003-005 P-001002-001 Q-0002002-005 P-001001-001 Q-0002001-005 P-001000-001 Q-0002000-005 Thanks in advance im building a forum and i was wondering how to make page numbers work, so only 10 or 20 posts show up, then it shows page 2, etc. like. 1, 2, 3, 4, 5 even better would be something like phpbb: 1 ... 6, 7, 8 im assuming this is some pretty advanced coding involved.... Code: [Select] <?php $query = "SELECT * FROM forum_posts WHERE topic_no='".$_REQUEST['topic_no']."' ORDER BY date ASC"; $result = mysql_query($query) or die("Error: ".mysql_error()); $fnames = array(); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $fnames[] = $row; } for ($i = 0; $i < count($fnames); $i++) { $query = "SELECT views FROM forum_posts WHERE topic_no='".$fnames[$i][8]."' AND author='1'"; $result = mysql_query($query) or die("Error: ".mysql_error()); $views = array(); $views = mysql_fetch_array($result, MYSQL_NUM); $query = "SELECT createdate,alliance,rank,country,username FROM users WHERE username='".$fnames[$i][1]."'"; $result = mysql_query($query) or die("Error: ".mysql_error()); $user = array(); while ($row = mysql_fetch_array($result, MYSQL_NUM)) {$data = $row;} $query = "SELECT logo FROM udata WHERE username='".$fnames[$i][1]."'"; $result = mysql_query($query) or die("Error: ".mysql_error()); $logo = array(); while ($row = mysql_fetch_array($result, MYSQL_NUM)) {$logo = $row;} $query = "SELECT COUNT(username) FROM forum_posts WHERE username='$data[4]'"; $result = mysql_query($query) or die("Error: ".mysql_error()); $postc = mysql_fetch_array($result, MYSQL_NUM); $logoi = '<img src="'.$logo[0].'" width="100" height="100" /><br><br>'; $query = "SELECT admin FROM users WHERE username='".$fnames[$i][1]."'"; $result = mysql_query($query) or die("Error: ".mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_NUM)) {$acount = $row;} if ($acount[0] == 1) { $mod[$i] = '<font color="lightgreen">ADMINISTRATOR</font><br>'; } else { $query = "SELECT mteam FROM users WHERE username='".$fnames[$i][1]."'"; $result = mysql_query($query) or die("Error: ".mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_NUM)) {$mcount = $row;} if ($mcount[0] == 1) { $mod[$i] = '<font color="lightgreen">MODERATOR</font><br>'; } } if ($fnames[$i][1] == $info[3]) { $buttons[$i] = ' <div class="forumbuttons"> <form action="forums_edit.php" method="post" class="lineup"> <input type="hidden" name="postid" value="'.$fnames[$i][0].'"> <input type="submit" name="edit" class="submit" value="Edit" /> </form> <form action="forums_topic.php" method="post" class="lineup"> <input type="submit" name="delete" class="submit" value="Delete" /> <input type="hidden" name="postid" value="'.$fnames[$i][0].'"> <input type="hidden" name="username" value="'.$fnames[$i][1].'"> <input type="hidden" name="topicname" value="'.$fnames[$i][2].'"> <input type="hidden" name="forumid" value="'.$fnames[$i][6].'"> <input type="hidden" name="topic_no" value="'.$fnames[$i][8].'"> <input type="hidden" name="author" value="'.$fnames[$i][5].'"> </form> </div> '; } else { $buttons[$i] = ' '; } echo ' <tr> <td class="variable" align="center" valign="top"><a class="variable" href="browse.php?name='.$fnames[$i][1].'">'.$fnames[$i][1].'</a></td> <td class="variable" align="left">Post Subject: <a class="noline">'.$fnames[$i][2].'</a></td> </tr> <tr> <td align="left" valign="top" class="variable"> <div style="margin-left:10px"> '.$mod[$i].' '.$logoi.' Joined: <a class="noline">'.date('d-m-Y', $data[0]).'</a><br> Posts: <a class="noline">'.$postc[0].'</a><br> Alliance: <a class="noline">'.$data[1].'</a><br> Rank: <a class="noline">'.$data[2].'</a><br> From: <a class="noline">'.$data[3].'</a><br> </div></td> <td align="left" valign="top" class="variable"><a class="noline">'.$fnames[$i][4].'</a> </td> </tr> <tr> <td align="left" valign="center" class="variable"><div style="margin-left:10px"><a href="#top">Top</a></div></td> <td class="variable" align="right" valign="top"><div class="forumbuttons">'.$buttons[$i].'</div></td> </tr> '; } ?> </table> <br> <form action="forums_topic.php" method="post"> <table width="540" class="metal" cellpadding="1" cellspacing="1"> <tr> <td colspan="2" class="head">Reply</td> </tr> <tr> <td width="108" height="19" valign="top" class="variable"><div align="left">Message body:<br> <a class="noline">Enter your message here, it may contain no more than <STRONG>60000</STRONG> characters.</a></div></td> <td width="381" class="variable"><textarea name="message" id="message" cols="60" rows="8"></textarea></td> </tr> <tr> <td height="19" colspan="2" valign="top" class="variable"><div align="center"> <input type="hidden" value="<?php echo $forumid;?>" name="forumid"> <input type="hidden" value="<?php echo $_REQUEST['topic_no'];?>" name="topic_no"> <input type="hidden" value="<?php echo $tname;?>" name="topicname"> <input name="posted_reply" type="submit" class="submit" id="button" value="Submit"> </div></td></tr> </table> </form> <?php } ?> the code above is the output for the posts. help would muchly be appreciated! Sorry if this belongs in the MySQL section. I figured it might be more of a PHP thing. I have a database where rows each have a number, which is used to determine what order they appear in on my PHP page. But right now they aren't like 1, 2, 3, 4, etc. They are a little jumbled because of deleting some and changing some, so they're more like 1, 3, 7, etc. Is there a way to make them 1, 2, 3, 4 with PHP? Like, put them in order and number them accordingly? Thanks. function forum_number_format($number, $decimals = 0) { global $lang_common; $x = round($number); $x_number_format = number_format($x); $x_array = explode(',', $x_number_format); $x_parts = array('k', 'm', 'b', 't'); $x_count_parts = count($x_array) - 1; $x_display = $x; $x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : ''); $x_display .= $x_parts[$x_count_parts - 1]; return $x_display; //return is_numeric($number) ? number_format($number, $decimals, $lang_common['lang_decimal_point'], $lang_common['lang_thousands_sep']) : $number; }Let's take a look at this code. This is VERY, VERY hard for me to understand. But it's essentially converting numbers to their kilobyte equivalent. (For example: 1000 = 1k. 25000 = 25k 15000 = 15k My issue is.. What happens when the number is 1321 This will output 1.3k Why? Because it's using the round function on line 4. But, I'm trying to get it to display 1.32k Any idea how to do this? I've been trying: $x = round($number, 1);and other methods but with no luck. Edited by Monkuar, 23 January 2015 - 02:55 PM. Hello, i have an array like: Code: [Select] Array ( [0] => http://www.google.com/asdasfsdafas [1] => http://www.google.com/join.html [2] => http://www.google.com/dfsgjkd [3] => http://www.google.com/join.html [4] => http://www.google.com/ddfgyyhujh [5] => http://www.google.com/join.html [6] => http://www.google.com/ghklkl )I'm trying to transform it like: Code: [Select] Array ( [0] => http://www.google.com/asdasfsdafas [1] => http://www.google.com/dfsgjkd [2] => http://www.google.com/ddfgyyhujh [3] => http://www.google.com/ghklkl )I used array_fliter but with no success any advise? Thanks Hey Guys, i have now managed to upload my site, products are listed from the database-great! However, when checkout is clicked you cannot update the cart with quantities and then click pay, it instead skips this and just empties the cart. Spent hours and getting nowhere! Can sum1 please help? My site: http://www.afebmunn.webhostingdeluxe.com/inkcrazy/index.php My site has been working fine for years but, all of a sudden, is throwing server errors on the pages that call for PHP includes. My provider isn't saying whether there's been an update but the fact that the site has always worked fine and now isn't, well...
So, here's some sample code from a .html page that calls for the TPL file:
<?php include('/home/MyPath/public_html/MySite.com/tpl/footer.tpl'); ?>
A long time ago, I was told to put this in my htaccess file:
AddType application/x-httpd-php5 .html
AddHandler application/x-httpd-php5 .html
If I delete both of these lines from the htaccess file, the site will load without the internal server error but my includes don't work at all. There's just an empty space where the content from the tpl file is supposed to be. I know they installed php 5.4 but my site was automatically put on 5.2 as a default.
I submitted a ticket with my provider and this was the response.
This is the error message as it is being recorded from the server itself when the domain returns a 500 error: [root@provider /home1/MyPath/public_html/mysite.com]# grep mysite.com /usr/local/apache/logs/error_log |tail -6 [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] Cannot load the ionCube PHP Loader - it was built with configuration 2.2.0, whereas running engine is API220100525,NTS, referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] Zend Optimizer requires Zend Engine API version 220060519., referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] The Zend Engine API version 220100525 which is installed, is newer., referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] Contact Zend Technologies at http://www.zend.com/ for a later version of Zend Optimizer., referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] , referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] malformed header from script. Bad header=<br />: index.html, referer: http://www.mysite.com/ This will be because there is a mismatch between the php version being called and the php.ini that is being loaded for the domain. Reviewing the mod_rewrite statements that call the various php versions within the direct file path to your domain shows the following: [root@provider /home1/MyPath/public_html/mysite.com]# grep -H -A 3 -B 1 'AddHand' /home1/MyPath/.htaccess /home1/MyPath/public_html/.htaccess /home1/MyPath/public_html/mysite.com/.htaccess /home1/MyPath/.htaccess-# Use PHP52 as default /home1/MyPath/.htaccess:AddHandler application/x-httpd-php52 .php /home1/MyPath/.htaccess-<IfModule mod_suphp.c> /home1/MyPath/.htaccess- suPHP_ConfigPath /opt/php52/lib /home1/MyPath/.htaccess-</IfModule> -- /home1/MyPath/public_html/mysite.com/.htaccess-#AddType application/x-httpd-php5 .html /home1/MyPath/public_html/mysite.com/.htaccess:#AddHandler application/x-httpd-php5 .html /home1/MyPath/public_html/mysite.com/.htaccess- /home1/MyPath/public_html/mysite.com/.htaccess- /home1/MyPath/public_html/mysite.com/.htaccess-## You would need to also declare the suphp for the php.ini to be used and upload a version matching php.ini to that location.I am completely lost as to what this means. I don't even know where to begin. Can someone please help me so I can get my site back to normal? Thank you in advance! Need help urgent. the website sudden prompt out error below: Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/var/www/vhosts/db2020.co.uk/application/application/config/admin/config.live.php) is not within the allowed path(s): (/var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs:/tmp) in /var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs/index.php on line 11 Warning: require_once(/var/www/vhosts/db2020.co.uk/application/application/config/admin/config.live.php) [function.require-once]: failed to open stream: Operation not permitted in /var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs/index.php on line 11 Fatal error: require_once() [function.require]: Failed opening required '/var/www/vhosts/db2020.co.uk/application/application/config/admin/config.live.php' (include_path='.:') in /var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs/index.php on line 11 and also after this problem occur, trafic of this domain go overlimit. how can i solve this problem? urgent.... website = https://db2020.co.uk/ thanks. Greetings all! I've been working on a project for about a week now and everything had been going fine until this evening. I'm querying a single row from a user information table based on the userID and doing various things based off of the information that is returned. For whatever reason, the query is not returning all of the information anymore. Code follows: Code: [Select] $userToEdit = mysqli_real_escape_string($GLOBALS['link'], $_POST['userToEdit']); $userSQL = "SELECT fName, lName, email, volunteer, staff, admin, active, volunteerID FROM userinfo WHERE userID=" . $userToEdit; $result = mysqli_query($GLOBALS['link'], $userSQL); if (!$result) { $message = 'There was an error retrieving the user information from the database.'; include '../html/error.html.php'; exit(); } $editInfo = mysqli_fetch_assoc($result); The strange part is that the database i'm querying is located on my remote host(GoDaddy). When I run the app from my local Apache server and query the remote DB, everything works fine, however, when I upload the files to my host, not all of the information is being returned. For example, using the print_r() function while on my local host, i get: Code: [Select] Array ( [fName] => Taylor [lName] => Hughes [email] => taylor@gmail.com [volunteer] => 1 [staff] => 0 [admin] => 0 [active] => 1 [volunteerID] => 13 ) But when I execute the app on my remote host, the print_r() function outputs: Code: [Select] Array ( [fName] => Taylor [lName] => Hughes [email] => taylor@gmail.com [volunteer] => [staff] => [admin] => [active] => [volunteerID] => 13 ) I'm not sure why this is happening but it is affecting multiple queries and subsequently multiple forms and functionality in different parts of the application. Any thoughts or suggestions would be greatly appreciated. I've browsed around for about an hour with no luck. I'm writing in PHP 5.3 and the remote MySQL DB is version 5.0 Oh! And if it helps, I just came to the realization that all the items not being returned are of the BIT data type in the tables. I have a foreach loop as foreach ($xml->channel->item as $value){ $title = $value->title; $text = $value->text; echo "$title <br /> $text"; } I want to skip any entry in which the title contains a character like ":" I have three records in this table, yet the script below only displays two records, skipping the first item. I have tried it in other fields also, and it is always skipping the first record? Code: [Select] $result = mysql_query("SELECT * FROM `content_type_ads`"); $row = mysql_fetch_array( $result ); while($row = mysql_fetch_array($result)){ echo $row['nid']. " - ". $row['field_item_id_value']; echo "<br />"; } This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=330724.0 Hey guy's, have been stuck at this hurdle for a little whole now and I can't seem to find the right solution and would very much appreciate anyones help on this. Ok, so I have a table of votes and each time a user votes, they're added to this table. Now, I have a 'pool' table which will display certain items. What I'm trying to do is display the 'pool' items, but if this specific user has already voted on this particular item, then I want it to skip the item in the 'pool' and go to the next item, until the argument of has that user voted is false. The current code I'm pasting will obviously not work, it isn't even in the right position, but I've separated it so that you can hopefully understand what I'm trying to do in order to help. Below is the code I use to check if a user has already voted on a particular photo: <?php $result=mysql_query("SELECT * FROM votes WHERE vVoter='$_SESSION[userID]' AND vPhoto='$_SESSION[currentphoto]'"); $rowCheck = mysql_num_rows($result); $alreadyv = 0; if($rowCheck > 0){ $alreadyv = 1; //user has already voted on this photo, need to use this info to be able to skip it in the 'pool' } else { //do nothing } ?> totalVoted is basically how many times a user has voted, so that people who vote more, get more votes: <?php $result=mysql_query("SELECT * FROM pool ORDER BY totalVoted DESC LIMIT 1"); $rowCheck = mysql_num_rows($result); if($rowCheck > 0){ while($row = mysql_fetch_array($result)){ $photoid = $row['photoInPool']; $result2=mysql_query("SELECT * FROM photos WHERE pID='$photoid'"); $rowCheck2 = mysql_num_rows($result2); if($rowCheck2 > 0){ while($row2 = mysql_fetch_array($result2)){ if($alreadyv == 1) { //I NEED THIS TO SHOW THE NEXT PHOTO IN THE ARRAY, HOWEVER, IF THEY HAVE ALREADY VOTED ON THE NEXT PHOTO, IT WILL STILL DISPLAY IT, THIS IS MY PROBLEM I NEED HELP WITH PLEASE } elseif ($alreadyv != 1) { $fname = $row2['pFileName']; } } } $_SESSION[currentphoto] = $row['photoInPool']; echo "<center><img src='user_images/$fname'></center>"; } } ?> I hope I've explained this well enough and hope somebody can help. Many thanks in advance I have a simple foreach loop. The array has four rows in it. Really simple. I have confirmed the data in the array with var_dump. For some reason I cannot fathom, the loop is only processing rows 0 and 2 and is not processing 1 and 3.
Here's the code snippet:
<?php foreach ($postCals as $key=>$cal){ var_dump($postCals, $cal, $key); echo '<td style="text-align:right;>' . $cal . "</td>"; } ?>$postCals has precisely 4 values. Here's the output from this part of the code (in terms of the var_dumps). array (size=4) 0 => string '2.00000' (length=7) 1 => string '2.00000' (length=7) 2 => string '3.20000' (length=7) 3 => string '4.00000' (length=7) string '2.00000' (length=7) int 0 array (size=4) 0 => string '2.00000' (length=7) 1 => string '2.00000' (length=7) 2 => string '3.20000' (length=7) 3 => string '4.00000' (length=7) string '3.20000' (length=7) int 2 That's it. I two other foreach loops identical to this and they run fine! Any ideas? (misc info: php: 5.4.7 running on XAMPP/Windows ) This is new. For some reason, the PHP errors are not counting my //commented lines.
Example:
<?php //my comment : ?>Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2 The error is on line 3. If I add more comments, the error is the same: <?php //my comment //my comment //my comment //my comment //my comment : ?>Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2 Where is this setting? Thanks. |