PHP - Is There Anyone Could Solve My Math Problem
My code is
$answer = (1/212500); output is 4.90205690308E-6 while I need I output as 0.00000470588 Please help, and tell me what is the specific problem, Similar TutorialsThis is how it should look. basic xml file http://wiistream.net/php/user/pictures/gallery.xml but this is how it looks. http://wiistream.net/php/user/pictures/gallery.php?username=Mancent&user_folder=Mancent_Pictures mysql php xml file with category's. This is whats making it so hard the category's Im using 3 tables one table is for my friends and one table is the category folder name and the other table is the picture holder with the category folder name so I thought i could do a if statement if user_folder = user_folder from the two tables it would keep the correct images in the correct category. But 3 weeks later still no luck. Heres what I got so far. <?php //lets get the mysql connection information. include "../../connect.php"; //we need this because the flash stores the xml file in temp internet history. Header('Cache-Control: no-cache'); Header('Pragma: no-cache'); //ok flash sent out the username $username = mysql_real_escape_string($_GET['username']); //ok flash sent out the folder name $user_folder = mysql_real_escape_string($_GET['user_folder']); $user_folder = (isset($_GET['friend'])) ? ' AND b.user_folder = \'' . mysql_real_escape_string($_GET['user_folder']) . '\' ' : NULL; //this part will be used becasue we need to see if friendship has ben made. $friend = (isset($_GET['friend'])) ? ' AND b.friend = \'' . mysql_real_escape_string($_GET['friend']) . '\' ' : NULL; //Ok lets select the username from the accounts table to see if they are a user.. $get_username = "SELECT * FROM accounts WHERE username = '$username'"; $username_results = mysql_query($get_username) or die("Data not found."); //Get the number of results from the query. $check_username_mysql_rows = mysql_num_rows($username_results); //If there is a match for the username, echo the the users xml data. if($check_username_mysql_rows == 1) { $sql1 = "SELECT a.username,a.user_folder,b.username FROM user_image_folders as a JOIN `user_friends_list` as b ON (b.friend = a.username)WHERE (b.username = '$username' $user_folder $friend AND b.status = 1)"; $result1 = mysql_query($sql1); //TODO MAKE THE FRIENDSHIP WORK WITH THIS $sql = "SELECT a.username,a.user_folder,a.user_folder,a.large_pic,a.small_pic,a.pic_title,a.pic_discription,b.username FROM user_photo_gallery as a JOIN `user_friends_list` as b ON (b.friend = a.username)WHERE (b.username = '$username' $user_folder $friend AND b.status = 1)"; $result2 = mysql_query($sql); $user_xml = "<?xml version=\"1.0\"?>\n"; $user_xml .= "<settings>\n"; $user_xml .= "<sceneHeight>600</sceneHeight>\n"; $user_xml .= "<sceneWidth>1000</sceneWidth>\n"; $user_xml .= "<titleColor>#000000</titleColor>\n"; $user_xml .= "<descriptionBgAlpha>70</descriptionBgAlpha>\n"; $user_xml .= "<showFullscreenBtn>no</showFullscreenBtn>\n"; $user_xml .= "<waterMark useImage=\"no\"><![CDATA[THIS]]></waterMark>\n"; $user_xml .= "</settings>\n"; $user_xml .="<galleries>\n"; //{ while ($i_get_myfriends = mysql_fetch_assoc($result1)) { $user_xml .="<gallery theName=\"". $i_get_myfriends['user_folder'] ."\" itemsPerRow=\"3\" autoStart=\"no\" playTime=\"5\" autoResize=\"yes\" xOffset=\"5\" yOffset=\"10\" showTitleOnThumbs=\"yes\" allowDownload=\"yes\">\n"; while ($i_get_myfriends2 = mysql_fetch_assoc($result2)) { //if($i_get_myfriends['user_folder'] ==$i_get_myfriends2['user_folder']) //{ $user_xml .="<picture largePicture=\"". $i_get_myfriends2['large_pic'] ."\" smallPicture=\"". $i_get_myfriends2['small_pic'] ."\" theTitle=\"". $i_get_myfriends2['pic_title'] ."\"><![CDATA[". $i_get_myfriends2['pic_discription'] ."]]>\n"; $user_xml .="</picture>\n"; //} } $user_xml .="</gallery>\n"; } $user_xml .="</galleries>\n"; echo $user_xml; } else { echo "Wiistream Eorror!\n"; } ?> See all the images are going into one folder.. and they are sopost to go into the friends folder it they are the friends pictures. but they are all in my folder.. Code: [Select] Warning: SimpleXMLElement::addChild() [simplexmlelement.addchild]: unterminated entity reference limit=50&method=GET&access_token=AAACd5Mcn7VQBAKaupEZCocujRuoBzzWeZCj945ZApHEsv5BZAxZCJfS62cSSz4txlZBUZAec03GcjpHdk0NTotnglt2ZB41GzzeYl8xqIZBmsvlS6UZAoHZB1A4&offset=50 in /home/content/71/8432771/html/facebook/get/friends.php on line 62 Code: [Select] <?php /** * Copyright 2011 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ require '../../src/facebook.php'; // Create our Application instance (replace this with your appId and secret). $facebook = new Facebook(array( 'appId' => 'APPID', 'secret' => 'SECRET', )); // Get User ID $user = $facebook->getUser(); // We may or may not have this data based on whether the user is logged in. // // If we have a $user id here, it means we know the user is logged into // Facebook, but we don't know if the access token is valid. An access // token is invalid if the user logged out of Facebook. if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me/friends?fields=id,name,first_name,last_name,picture&limit=50'); } catch (FacebookApiException $e) { error_log($e); $user = null; } } // Login or logout url will be needed depending on current user state. if ($user) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } $profile = array ($user_profile); $xml = new SimpleXMLElement('<root/>'); arrayToXML( $xml, $profile ); echo $xml->asXML(); function arrayToXML( SimpleXMLElement &$xml, $array ) { foreach( $array as $name => $value ) { if( !is_array($value) ) $xml->addChild( $name, $value ); else { $child = $xml->addChild( $name ); <----------------------------------------------LINE 64 arrayToXML( $child, $value ); } } } ?> Here is the array Code: [Select] { "data": [ { "name": "Pauline Latty", "id": "312293" }, { "name": "Noah Ethan Schinasi", "id": "55101245" }, { "name": "Luis Guerrero", "id": "194803212" }, { "name": "Nakia Johnson", "id": "500350828" }, { "name": "Bethany Vallerie", "id": "502062429" }, { "name": "Caroline Franks", "id": "505331027" }, { "name": "Andrew Shivers", "id": "505749817" }, { "name": "Sandra G Garcia", "id": "508006303" }, { "name": "Catherine Davis", "id": "511006416" }, { "name": "Marc Watson", "id": "511201074" }, { "name": "Laura Clarke", "id": "513653820" }, { "name": "Amanda Rice", "id": "514062403" }, { "name": "Scott Alan Buss", "id": "514197867" }, { "name": "Evangelist Josephus", "id": "515837621" }, { "name": "Chet Fontenot", "id": "516199085" }, { "name": "Sharon Howard", "id": "516580144" }, { "name": "Chatt Franco", "id": "517211511" }, { "name": "Lydgia Vanessa Staples", "id": "518094760" }, { "name": "Corry Bell", "id": "521043483" }, { "name": "Lessie Tyson", "id": "521855454" }, { "name": "Jawahar Peter", "id": "523159934" }, { "name": "Sheena Shiko", "id": "523461577" }, { "name": "Pat Larry Thomas", "id": "523555768" }, { "name": "Oyenuga Kunle Johnson Matthew", "id": "524263978" }, { "name": "Angela Whitten", "id": "524631356" } ], "paging": { "next": "https://graph.facebook.com/me/friends?limit=25&access_token=2227470867|2.AQAMMvJya05xkLhR.3600.1318057200.0-100001957015772|IUAhNlekyalf7sxy-OjdJd7KCwo&offset=25" } } its that paging, I can not seem to get that to work yet. Hi, My hosting company (Bluehost) told me when someone goes to my home page, it sends these series of queries and this is the reason for my high cpu usage and this is why my site says Error Establishing Database. The hosting company gave me these: Each script is using a decent about of CPU. [2:09:33 AM] hollane3 31881 6.2 0.1 186084 49000 ? RN 01:59 0:26 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 934 6.6 0.1 184012 48652 ? RN 01:59 0:25 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 5344 7.1 0.1 184008 48440 ? RN 02:01 0:21 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/wp-cron.php hollane3 5164 7.1 0.1 186444 48772 ? RN 02:01 0:22 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 7246 6.9 0.1 184116 48196 ? RN 02:02 0:18 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 11221 5.8 0.1 185160 47852 ? RN 02:03 0:09 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 11236 6.4 0.1 182992 47620 ? RN 02:03 0:10 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/wp-cron.php hollane3 12595 5.4 0.1 183088 47264 ? RN 02:04 0:07 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 13969 5.4 0.1 184648 47396 ? RN 02:04 0:05 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 14161 6.1 0.1 182480 47140 ? RN 02:04 0:06 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/wp-cron.php hollane3 14198 6.7 0.1 183092 47204 ? RN 02:04 0:06 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php hollane3 16343 4.9 0.1 181968 46496 ? RN 02:05 0:02 | \_ /ramdisk/bin/php5 /home4/hollane3/public_html/index.php I am not well versed with scripting, so I don't know what this mean. Can anyone PLEASE help me to answer these questions: + Is this related to a particular plugin or widget or theme? + What could be the possible source of this issue, that is, which file should I look at to resolve this? + Can I fix this myself or do I need a php coder to help me? Thanks! This topic has been moved to PHP Math Help. http://www.phpfreaks.com/forums/index.php?topic=350528.0 Can some PHP guru help me with this scenarios? I've been wondering around these for hours and can't find my way around it. Please... 1. Write a function in PHP that takes three parameters (representing day, month and year) and calculates the day/month/year of the following day (for example, if the parameter is 31/10/2010, the result should be 01/11/2010). No need to take into account leap years. You cannot use any date/time specific functions, you must do it "by hand" (no built-in functions).. 2. Write a function in PHP that takes a string and counts the number of occurrences of any given letter in it (for example, given the string "HELLO" as a parameter, there are two occurrences of "L", one of "H", one of "E", one of "O" and zero of any other character).
<!DOCTYPE html> <html> <body> <form action="Practice 1.1.php" method="post"> Catagory Code:<input type="text" name="n" size="2"><br> Units Used <input type="text" name="u" size="2"> <br> <input type="submit" value="Calculate"> </form> <?php $a=$_POST['n']; $b=$_POST['u']; if ($b<=3.75) { echo ""; } ?> </body> </html>
This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=306725.0 Hey.. hoping someone can help me on a this issue I have been having for 4 days now. My host has tried to figure out what is causing it and has told me they are finding it very strange, everytime my website is up on their server it will take 600%-800% CPU so they must take it down for fair usage on other customers of course. They said they can easily track and trace websites that are overloading the resources but mine seems too complicated to understand as it is having legitmate traffic (on average 30 users online and 300 visits daily) which would never be the cause of CPU spikes to 600%-800%. They either believe it is a "clever attack" or some PHP script perhaps looping like mad. Anyone help me and my host figure out the problem as we obviously both don't like the website to continue to be offline. The website has very standard content CMS running and clean database it makes no sense to the both of us. Like to mention the last activity I had done on the website was when I tried to insert into database:- Code: [Select] Query failed: errorno=126 error=Incorrect key file for table './teamxcom_webspell/ws_bi2_cup_matches.MYI'; try to repair it query=DELETE FROM ws_bi2_cup_matches WHERE matchno='5' && type='gs' && ladID='0' && 1on1='1' Then after I tried to perform query from database: Code: [Select] Error SQL query: SELECT * FROM `ws_bi2_cup_matches` ORDER BY `ws_bi2_cup_matches`.`matchID` DESC LIMIT 0 , 30 MySQL said: #1030 - Got error 134 from storage engine Then found out the table on phpmyadmin had wrong page numbers in sequence:- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 379, 746, 1113, --, --, --7349 After I contacted web host they mentioned it is causinga massive problem and took it down after that. Anyone can shed some light on this please? Sorry if it is posted in wrong section! Thanks very much I have following errors in below coding. Can anyone point out me where i went wrong?? Undefined variables: fname,focu,foad,ftp,fmf,mname,mocu,moad,mtp,mmf,gname,gocu,goadd,gtp,gmf in C:\wamp\www\Student registration\manage studnt parent details\manageStudentRegistrationParentDetailsForm.php manageStudentRegistrationParentDetailsForm.php Code: [Select] <?php $query="SELECT state,name,occupation,office_address,office_telephone,mobile_number FROM parent_info where admission_no='$admission_no'"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $first=$row['state']; if($first=='father'){ $fname=$row['name']; $focu=$row['occupation']; $foadd=$row['office_address']; $ftp=$row['office_telephone']; $fmf=$row['mobile_number']; } if($first=='mother'){ $mname=$row['name']; $mocu=$row['occupation']; $moadd=$row['office_address']; $mtp=$row['office_telephone']; $mmf=$row['mobile_number']; } if($first=='guardians'){ $gname=$row['name']; $gocu=$row['occupation']; $goadd=$row['office_address']; $gtp=$row['office_telephone']; $gmf=$row['mobile_number']; } } ?> ---- ---- <tr> <td> </td> <td colspan="5"><h3> <label><strong>Parents/Guardian information</strong></label> <strong> </strong></h3></td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><label>Admission No</label> </td> <td colspan="2" align="left"><?php echo $admission_no ;?></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> <input type="checkbox" name="checkbox" id="checkbox" <?php if($fname!=null){ ?> checked="checked" <?php }?> onclick="father()" /> <label>fathers details</label></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label> Name</label> </td> <td><input type="text" name="Name1" id="textfield" value="<?php echo $fname; ?>" disabled="disabled" /></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Occupation</label> </td> <td> <input type="text" name="Occupation1" id="textfield2" value="<?php echo $focu; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Address</label> </td> <td> <textarea name="Office_Address1" id="office_address" cols="45" rows="5" disabled="disabled"><?php echo $foadd; ?></textarea> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Telephone Number</label> </td> <td> <input type="text" name="Office_tel1" id="textfield4" value="<?php echo $ftp; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Mobile Phone Number</label></td> <td> <input type="text" name="Mobile_pho1" id="textfield5" value="<?php echo $fmf; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> <input type="checkbox" name="checkbox2" id="checkbox2" <?php if($mname!=null){ ?> checked="checked" <?php }?> onclick="mother()" /> <label>Mothers details</label></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label> Name</label> </td> <td> <input type="text" name="Name2" id="textfield3" value="<?php echo $mname; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Occupation</label> </td> <td> <input type="text" name="Occupation2" id="textfield7" value="<?php echo $mocu; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Address</label> </td> <td> <textarea name="Office_Address2" id="textarea" cols="45" rows="5" disabled="disabled"><?php echo $moadd; ?></textarea> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Telephone Number</label> </td> <td> <input type="text" name="Office_tel2" id="textfield8" value="<?php echo $mtp; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Mobile Phone Number</label> </td> <td> <input type="text" name="Mobile_pho2" id="textfield9" value="<?php echo $mmf; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> <input type="checkbox" name="checkbox3" id="checkbox3" <?php if($gname!=null){ ?> checked="checked" <?php }?> onclick="Guardian()"/> <label>Guardian details</label></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label> Name</label> </td> <td> <input type="text" name="Name3" id="textfield6" value="<?php echo $gname; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Occupation</label> </td> <td> <input type="text" name="Occupation3" id="textfield10" value="<?php echo $gocu; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Office Address</label> </td> <td> <textarea name="Office_Address3" id="textarea2" cols="45" rows="5" disabled="disabled"><?php echo $goadd; ?></textarea> </td> <td> </td> <td> </td> <td> </td></tr> <tr> <td> </td> <td colspan="2"><label>Office Telephone Number</label> </td> <td> <input type="text" name="Office_tel3" id="textfield11" value="<?php echo $gtp; ?>" disabled="disabled"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr><td> </td> <td colspan="2"><label>Mobile Phone Number</label> </td> <td> <input type="text" name="Mobile_pho3" id="textfield12" value="<?php echo $gmf; ?>" disabled="disabled" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td> <input type="submit" name="button" id="button" value="Save" /> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <p> </p> <p> </p></td> </tr> Hello guys, I'm trying to solve my hometask . I tried in many different ways to solve the task related with Advanced SQL Syntax. Please check the pic below: The Quiz is asking for make location appear in all uppercase letters, the character associated with a given ASCII value and the table is people. I tried the last one in this way: SELECT CONCAT(name,'is from',strtoupper(location),' The ASCII character of the number ',number,' is ',ASCII(number)) FROM `people` WHERE 1 but it doesn't work. Can someone help me? Thanks This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=327462.0 Hi, I read the HEADER advice on the forum but I think that I still need help to figure out what I am doing wrong with header("location: page_to_load"). In local, the redirection works without problems. When I test online on a free server (p4o.net), it works fine; but when I test it on the paid server (mediaserve.com), the redirect loads a blank page. After the blank page is loaded, I manually load the protected page (MyAccount.php) and all the information were displayed successfuly. I logged out and signed in with wrong credential. The result is a blank page. I manually loaded MyAccount.php again and I had "Access denied". I then concluded that the redirection deos not work. Is there any work arround for this situation? Please help. Thanks Login.php Code: [Select] <form id="login" method="POST" action="handlers/login_handler.php"> <strong>Username</strong> <input name="TextBoxEmailAdress" type="text" id="TextBoxEmailAddress" /> <strong>Password</strong> <input name="TextBoxPassword" type="password" id="TextBoxPassword" /> <input name="ButtonSubmit" value="Login" id="ButtonSubmit" type="submit" /> </form> login_handler.php Code: [Select] <?php ob_start(); //Start session session_start(); //Include database connection details require_once('../includes/WebConfig.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $Var_EmailAddress = clean($_POST['TextBoxEmailAddress']); $Var_Password1 = clean($_POST['TextBoxPassword']); //Input Validations if($Var_EmailAddress== '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($Var_Password1== '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } //If there are input validations, redirect back to the login form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: ../index.php?PageId=login"); exit(); } //Create query $Var_Password1 = md5($Var_Password1); $query="SELECT * FROM $tbl_member WHERE EmailAddress='$Var_EmailAddress' AND Password1='$Var_Password1'"; $result=mysql_query($query); //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['Member_Id']; $_SESSION['SESS_FIRST_NAME'] = $member['FirstName']; $_SESSION['SESS_LAST_NAME'] = $member['LastName']; $_SESSION['SESS_EMAIL_ADDRESS'] = $member['EmailAddress']; $_SESSION['SESS_ADMIN_ROLE'] = $member['AdminRole']; $_SESSION['SESS_CONTRIB_EMAIL'] = ""; session_write_close(); header("location: ../MyAccount.php"); exit(); } else { //Login failed header("location: ../index.php?PageId=login-failed"); exit(); } } else { //echo "mysql error: " .mysql_error(); //echo "<br> mysql error number: " .mysql_errno(); //die("Query failed"); //Login failed header("location: ../index.php?PageId=login-failed"); } ?> Im trying to add value into my database and i keep getting the following error
"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 '','','4','Telegraph (IRE)','3','9-3','','57','Evans, P D','28/1 ','Egan, John '' at line 1" my query looks like this mysqli_query($db,"INSERT INTO `Horses` (`Date`,`Track`,`Runners`, `Going`, `Distance`,`Class`,`Place`,`Losing_Dist`,`Stall`,`Horse`,`Age`,`Weight`,`Headgear`,`Horse_OR`,`Trainer`,`Odds`,`Jockeys_Claim`,`Comments`,`Race_Name` )VALUES ('$date','$place','$norunner','$going','$distance','$class',$place','$distance_bt','$stall','$horse','$age','$weight','$headgear','$OR','$trainer','$odds','$jockey','$comments','$event')")or die(mysqli_error($db));and my table looks like this: Column Type Null Default ID int(255) No Date varchar(250) Yes NULL Track varchar(100) Yes NULL Runners varchar(50) Yes NULL Going varchar(50) Yes NULL Distance varchar(50) Yes NULL Class varchar(50) Yes NULL Place varchar(10) Yes NULL Losing_Dist varchar(50) Yes NULL Stall varchar(250) Yes NULL Horse varchar(50) Yes NULL Age varchar(50) Yes NULL Weight varchar(50) Yes NULL Headgear varchar(50) Yes NULL Horse_OR varchar(50) Yes NULL Trainer varchar(50) Yes NULL Odds varchar(50) Yes NULL Jockeys_Claim varchar(50) Yes NULL Comments varchar(250) Yes NULL Race_Name varchar(250) Yes NULL Hello! I have this approach on form validation(I'm just a newbie) Code: [Select] <?php if(isset($_POST['submit'])) { $proj_name = me_mysql_prep(trim($_POST['proj_name'])); $proj_content = me_mysql_prep($_POST['proj_content']); if(empty($_POST['proj_name'])) { $empty_name = array('Project Name Cannot Be Empty'); } if(empty($_POST['proj_content'])) { $empty_content = array('Content Cannot Be Empty'); } if(isset($empty_name) || isset($empty_content)); { $error_merge = array_merge($empty_name, $empty_content); } if(!empty($error_merge)) { foreach($error_merge as $error) { echo "<span class=\"error_validation\">*". $error . "<br></span>"; } } else { $query = "INSERT into rec_projects (proj_name, content, date_reg) VALUES('{$proj_name}', '{$proj_content}', '{$datenow}')"; $result = mysql_query($query,$connection); } echo "<br><br>"; } ?> My problem is at this line Code: [Select] <?php if(isset($empty_name) || isset($empty_content)); { $error_merge = array_merge($empty_name, $empty_content); } ?> because if, let's say $empty_name is not set, I'm going to have an error like Quote "undefined $empty_name" or something like that. I wonder if there's a PHP function that disregard a value in an array if it's not set.. or you guys have different approach to solve and simplify this?? Since I'm new to programming I still don't know how to solve problems the most efficient way, I'd like to have your advice on this one. This is how I solved it and it works. I have my categories as input buttons (I'm planning to change it into a drop down menu later). Sort by Category: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type='submit' name='All' value='All' /> <input type='submit' name='Smileys' value='Smileys' /> <input type='submit' name='Faces' value='Faces' /> <input type='submit' name='Love' value='Love' /> </form> When the input boxes are clicked the corresponding script below is being run, very simple and to a point primitive, definitely not really efficient, because if you have a lot of categories you'll end up with a lot of code and if you wanted to change one thing you'd have to change it in all the IF BLOCKS. Basically every input button has its own IF BLOCK. <?php if (isset($_POST['All']) OR (!isset($_POST['Smileys']) && !isset($_POST['Faces']) && !isset($_POST['Love']) { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Retrieve the score data from MySQL $query = "SELECT * FROM asciiart"; $data = mysqli_query($dbc, $query); // Loop through the array of score data, formatting it as HTML while ($row = mysqli_fetch_array($data)) { echo '<table class="asciiartTable">'; // Display the score data echo '<tr><td class="asciiart_name">'; echo '<strong>' . htmlentities($row['asciiart_name']) . '</strong><br /></td></tr>'; echo '<tr><td class="asciiart_contribution"><pre>' . htmlentities($row['asciiart_contribution']) . '</pre><br /></td></tr>'; echo '<tr><td class="asciiart_categoryDate">' . htmlentities($row['asciiart_category']) . ' | ' . date('M d, Y', strtotime ($row['created_date'])) . ' </td></tr>'; echo '</table>'; } mysqli_close($dbc); } if (isset($_POST['Smileys'])) { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Retrieve the chosen category from MySQL $query2 = "SELECT * FROM asciiart WHERE asciiart_category = 'Smileys'"; $data2 = mysqli_query($dbc, $query2); //Loop through the array of data while ($row2 = mysqli_fetch_array($data2)) { echo '<table class="asciiartTable">'; // Display the score data echo '<tr><td class="asciiart_name">'; echo '<strong>' . htmlentities($row2['asciiart_name']) . '</strong><br /></td></tr>'; echo '<tr><td class="asciiart_contribution"><pre>' . htmlentities($row2['asciiart_contribution']) . '</pre><br /></td></tr>'; echo '<tr><td class="asciiart_categoryDate">' . htmlentities($row2['asciiart_category']) . ' | ' . date('M d, Y', strtotime ($row2['created_date'])) . ' </td></tr>'; echo '</table>'; } mysqli_close($dbc); } if (isset($_POST['Faces'])) { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Retrieve the chosen category from MySQL $query3 = "SELECT * FROM asciiart WHERE asciiart_category = 'Faces'"; $data3 = mysqli_query($dbc, $query3); //Loop through the array of data while ($row3 = mysqli_fetch_array($data3)) { echo '<table class="asciiartTable">'; // Display the score data echo '<tr><td class="asciiart_name">'; echo '<strong>' . htmlentities($row3['asciiart_name']) . '</strong><br /></td></tr>'; echo '<tr><td class="asciiart_contribution"><pre>' . htmlentities($row3['asciiart_contribution']) . '</pre><br /></td></tr>'; echo '<tr><td class="asciiart_categoryDate">' . htmlentities($row3['asciiart_category']) . ' | ' . date('M d, Y', strtotime ($row3['created_date'])) . ' </td></tr>'; echo '</table>'; } mysqli_close($dbc); } if (isset($_POST['Love'])) { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Retrieve the chosen category from MySQL $query4 = "SELECT * FROM asciiart WHERE asciiart_category = 'Love'"; $data4 = mysqli_query($dbc, $query4); //Loop through the array of data while ($row4 = mysqli_fetch_array($data4)) { echo '<table class="asciiartTable">'; // Display the score data echo '<tr><td class="asciiart_name">'; echo '<strong>' . htmlentities($row4['asciiart_name']) . '</strong><br /></td></tr>'; echo '<tr><td class="asciiart_contribution"><pre>' . htmlentities($row4['asciiart_contribution']) . '</pre><br /></td></tr>'; echo '<tr><td class="asciiart_categoryDate">' . htmlentities($row4['asciiart_category']) . ' | ' . date('M d, Y', strtotime ($row4['created_date'])) . ' </td></tr>'; echo '</table>'; } mysqli_close($dbc); } My question is: is there a way to have just one block of script and the script automatically inserts the right INPUT BUTTON into the query in the script? Something similar to this, even though it doesn't work I'm just showing it for showcase purposes: if (isset($_POST['Smileys']) || (isset($_POST['Faces']) || (isset($_POST['Love'])) { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Retrieve the chosen category from MySQL $query2 = "SELECT * FROM asciiart WHERE asciiart_category = 'Smileys' || 'Faces' || 'Love'"; $data2 = mysqli_query($dbc, $query2); Notice in the query, it is looking for THAT keyword that has been PRESSED on the INPUT BUTTON. How would I be able to create a logic like this so I can create a whole chain of categories? Thanks for advice. Ok, as far as I know this code should update correctly, but for some reason it's not, and I can't seem to figure out why. Here is the page: http://kaboomlabs.com/testbed/edit.php?id=1 Mind you this is meant to be seen in IE only, so if it looks odd on your browser I haven't gotten to tweaking it yet.... thanks for the help. Code: [Select] <?php require_once('../connectvars.php'); echo '<div id="postwrap">' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PDI NCMR - Edit</title> <link rel="stylesheet" type="text/css" href="../CSS/postie.css" /> </head> <body> <div id="logo"> <img src="../images/PDI_Logo_2.1.gif" alt="PDI Logo" /> </div> <?php if (isset($_POST['submit'])) { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Enter data into the database $ab = mysqli_real_escape_string($dbc, trim($_POST['ab'])); $date = mysqli_real_escape_string($dbc, trim(date('Y-m-d',strtotime ($_POST['date'])))); $part = mysqli_real_escape_string($dbc, trim($_POST['part'])); $rev = mysqli_real_escape_string($dbc, trim($_POST['rev'])); $partdesc = mysqli_real_escape_string($dbc, trim($_POST['partdesc'])); $ncmrqty = mysqli_real_escape_string($dbc, trim($_POST['ncmrqty'])); $comp = mysqli_real_escape_string($dbc, trim($_POST['comp'])); $ncmrid = mysqli_real_escape_string($dbc, trim($_POST['ncmrid'])); $rma = mysqli_real_escape_string($dbc, trim($_POST['rma'])); $jno = mysqli_real_escape_string($dbc, trim($_POST['jno'])); $fdt = mysqli_real_escape_string($dbc, trim($_POST['fdt'])); $cof = mysqli_real_escape_string($dbc, trim($_POST['cof'])); $fab1= mysqli_real_escape_string($dbc, trim($_POST['fab1'])); $fab2= mysqli_real_escape_string($dbc, trim($_POST['fab2'])); $fab3= mysqli_real_escape_string($dbc, trim($_POST['fab3'])); $non= mysqli_real_escape_string($dbc, trim($_POST['non'])); $dis= mysqli_real_escape_string($dbc, trim($_POST['dis'])); $comm= mysqli_real_escape_string($dbc, trim($_POST['comm'])); $caad= mysqli_real_escape_string($dbc, trim($_POST['caad'])); $po= mysqli_real_escape_string($dbc, trim($_POST['po'])); $pod = mysqli_real_escape_string($dbc, trim(date('Y-m-d',strtotime($_POST['pod'])))); $dri = mysqli_real_escape_string($dbc, trim(date('Y-m-d',strtotime($_POST['dri'])))); $query = "UPDATE ncmr SET ab = '$ab', date = '$date', part = '$part', rev = '$rev' , partdesc = '$partdesc' , ncmrqty = '$ncmrqty' , comp = '$comp' , ncmrid = '$ncmrid' , rma = '$rma' , jno = '$jno' , fdt = '$fdt' , cof = '$cof' , fab1 = '$fab1' , fab2 = '$fab2' , fab3 = fab3' , non = '$non' , dis = '$dis' , comm = '$comm' , caad = '$caad' , po = '$po' , pod = '$pod' , dri = '$dri' WHERE id = '" . $_GET['id'] . "'"; mysqli_query($dbc, $query); // Clear the form data $ab = ""; $date = ""; $part = ""; $rev = ""; $partdesc = ""; $ncmrqty = ""; $comp = ""; $ncmrid = ""; $rma = ""; $jno = ""; $fdt = ""; $cof = ""; $fab1= ""; $fab2= ""; $fab3= ""; $non= ""; $dis= ""; $comm= ""; $caad= ""; $po= ""; $pod = ""; $dri = ""; // Confirm success with the user echo '<p>If you wish to edit more NCMRs, please <a href="list.php">go to the admin page!</a></p>'; mysqli_close($dbc); } else { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Grab the profile data from the database if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } $data = mysqli_query($dbc, $query); if (mysqli_num_rows($data) == 1) { // The user row was found so display the user data $row = mysqli_fetch_array($data); echo'<div id="title"><h3 id="NCMR2">Non-Conforming Materials Report (NCMR: ' . $row['rma'] . ')</h3></div>'; echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>"; echo '<fieldset>'; echo '<div id="box1">'; if (empty($row['ab'])) $row['ab'] = "Empty"; if (empty($row['date'])) $row['date'] = "Empty"; if (empty($row['part'])) $row['part'] = "Empty"; if (empty($row['rev'])) $row['rev'] = "Empty"; if (empty($row['partdesc'])) $row['partdesc'] = "Empty"; if (empty($row['ncmrqty'])) $row['ncmrqty'] = "Empty"; echo '<div id="ab"><span class="b">Added By: </span><input type="text" name="ab" value="' . $row['ab'] . '" /></div>'; echo '<div id="date"><span class="b">Date Filed: </span><input type="text" name="date" value="' . $row['date'] . '" /></div>'; echo '<div id="part"><span class="b">Part Number: </span><input type="text" name="part" value="' . $row['part'] . '" /></div>'; echo '<div id="rev"><span class="b">Part Revision: </span><input type="text" name="rev" value="' . $row['rev'] . '" /></div>'; echo '<div id="partdesc"><span class="b">Part Description: </span><textarea rows="4" cols="22">' . $row['partdesc'] . '</textarea></div>'; echo '<div id="ncmrqty"><span class="b">NCMR Qty: </span><input type="text" name="ncmrqty" value="' . $row['ncmrqty'] . '" /></div>'; echo '</div>'; //Company, Customer NCMR, Internal RMA, and Job Number echo '<div id="box2">'; if (empty($row['comp'])) $row['comp'] = "Empty"; if (empty($row['ncmrid'])) $row['ncmrid'] = "Empty"; if (empty($row['rma'])) $row['rma'] = "Empty"; if (empty($row['jno'])) $row['jno'] = "Empty"; echo '<div id="comp"><span class="b">Company: </span><input type="text" name="comp" value="' . $row['comp'] . '" /></div>'; echo '<div id="ncmrid"><span class="b">Customer NCMR ID: </span><input type="text" name="ncmrid" value="' . $row['ncmrid'] . '" /></div>'; echo '<div id="rma"><span class="b">Internal RMA #: </span><input type="text" name="rma" value="' . $row['rma'] . '" /></div>'; echo '<div id="jno"><span class="b">Job #: </span><input type="text" name="jno" value="' . $row['jno'] . '" /></div>'; echo '</div>'; //Type of Failure and Class of Failure echo '<div id="box3">'; echo '<h2>Failure</h2>'; echo '<div id="cof"><span class="b">Class of Failu </span><input type="text" name="cof" size="15" value="' . $row['cof'] . '" /></div>'; echo '<div id="fdt"><span class="b">Failure Due To: </span><input type="text" name="fdt" size="15" value="' . $row['fdt'] . '" /></div>'; echo '</div>'; //Fabricators echo '<div id="box4">'; echo '<h2>Fabricators</h2>'; if ($row['fab1']="--None--") { echo'<div id="fab1">'; $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $mysqli->select_db('user'); $result = $mysqli->query("SELECT * FROM user"); echo "<SELECT name='fab1'>\n"; while($row = $result->fetch_assoc()) { echo "<option value='{$row['user']}'>{$row['user']}</option>\n"; } echo "</select>\n"; echo '</div>'; } else { echo'<div id="fab1">'; $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $mysqli->select_db('user'); $result = $mysqli->query("SELECT * FROM user"); echo "<SELECT name='fab1'>\n"; while($row = $result->fetch_assoc()) { echo "<option value='{$row['user']}'>{$row['user']}</option>\n"; } echo "</select>\n"; echo '</div>'; } if ($row['fab2']="--None--") { echo'<div id="fab2">'; $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $mysqli->select_db('user'); $result = $mysqli->query("SELECT * FROM user"); echo "<SELECT name='fab2'>\n"; while($row = $result->fetch_assoc()) { echo "<option value='{$row['user']}'>{$row['user']}</option>\n"; } echo "</select>\n"; echo '</div>'; } else { echo '<div id="fab2"><span class="b"></span><input type="text" name="fab1" size="20" value="' . $row['fab1'] . '" /></div>'; echo '</div>'; } if ($row['fab3']="--None--") { echo'<div id="fab3">'; $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $mysqli->select_db('user'); $result = $mysqli->query("SELECT * FROM user"); echo "<SELECT name='fab3'>\n"; while($row = $result->fetch_assoc()) { echo "<option value='{$row['user']}'>{$row['user']}</option>\n"; } echo "</select>\n"; echo '</div>'; } else { echo '<div id="fab3"><span class="b"></span><input type="text" name="fab1" size="20" value="' . $row['fab1'] . '" /></div>'; echo '</div>'; } echo '</div>'; //Nonconformity, Disposition, Comments and Comments & Additional Details echo '<div id="box5">'; if (empty($row['non'])) $row['non'] = "Empty"; if (empty($row['dis'])) $row['dis'] = "Empty"; if (empty($row['comm'])) $row['comm'] = "Empty"; if (empty($row['caad'])) $row['caad'] = "Empty"; echo '<div id="non"><span class="b">Nonconformity: </span><textarea rows="4" cols="105">' . $row['non'] . '</textarea></div>'; echo '<div id="dis"><span class="b">Disposition: </span><textarea rows="4" cols="105">' . $row['dis'] . '</textarea></div>'; echo '<div id="comm"><span class="b">Comments: </span><textarea rows="4" cols="105">' . $row['comm'] . '</textarea></div>'; echo '<div id="caad"><span class="b">Comments and/or Additional Details: </span><textarea rows="4" cols="105">' . $row['caad'] . '</textarea></div>'; echo '<div id="podr">'; if (empty($row['po'])) $row['po'] ="Empty"; if (empty($row['pod'])) $row['pod'] ="Empty"; if (empty($row['dir'])) $row['dri'] ="Empty"; echo '<div id="po"><span class="b">PO: </span><input type="text" name="po" size="7" value="' . $row['po'] . '" /></div>'; echo '<div id="pod"><span class="b">PO Date: </span><input type="text" name="pod" size="7" value="' . $row['pod'] . '" /></div>'; echo '<div id="dri"><span class="b">Date Received: </span><input type="text" name="dri" size="7" value="' . $row['dri'] . '" /></div>'; echo '</div>'; echo '<div id="button2"><input type="submit" value="Submit Edits" name="submit" /></div>'; echo '</div>'; echo '</fieldset>'; echo '</form>'; } } echo '</div>'; ?> </body> </html> First the problem is not so much php relate, as i actually doing it in C# however regular expression are same on all of them and i dont know any c# forums as good and active as phpfreaks so I've decided to post it here. My text is: Code: [Select] <div class="15ma">text-special character - numbers </div><div class="15ma">text-special character - numbers </div><div class="15ma">text-special character - numbers </div><div class="15ma">text-special character - numbers </div><div class="15ma">text-special character - numbers </div> No spaces between the dives or new lines. I thought of using this pattern: Code: [Select] <div class="15ma">(.+)<\/div> However kept looking at it and it just grabs the first <div class="15ma"> and the last </div> since i used (.+) it consider all the other as part of the inside text.. Any help would be highly appreciated. Thanks in advanced. CMS: PHP-Fusion version 9.03.110, PHP version: 7.4.16, MySQL Server Version: 5.7.33-log, DB Driver: PDO MySQL My own support people at PHP-Fusion main site have been unable to help me with this problem and I'm hoping for some new eyes and new input on this error. First of all my script works perfectly fine and outputs the result desired. I know that my script is not using PDO prepared statements and I am not prepared to modify it to do so because too much would have to be changed. And I'm not fluent on PDO. My script is an event calendar and can be seen at this url: https://windy.whisperwillow.net/grims_blog/index.php The error only occurs 3 times on 3 lines. <?php echo "<div class='col-sm-12'>\n"; include BASEDIR."grims_blog/include/cal_func_inc.php"; $day=date('d'); $endDate=date('t',mktime(0,0,0,$cMonth,$day,$cYear)); echo "<div><span class='hdspan2'><b>".$locale['gb_510']."</b></span></div><p>\n"; echo "<table class='tbl-responsive' width='67%' align='center' border='0' cellpadding='0' cellspacing='0'><tr>\n"; echo "<td align='center' colspan='3'><img style='max-width:100%;height:auto;' src='".BASEDIR."grims_blog/images/calhead/forest.jpg'></td>\n"; echo "</tr><tr height='30' bgcolor='#960000'>\n"; echo "<td align='left'> <a class='mcaldate' href='".FUSION_SELF."?month=$prev_month&year=$prev_year' title='Last Month'>".$locale['gb_511']."</a></td><td align='center'><span class='mnthhd'>".date("F Y",strtotime($cYear."-".$cMonth."-01"))."</span></td><td align='right'><a class='mcaldate' href='".FUSION_SELF."?month=$next_month&year=$next_year' title='Next Month'>".$locale['gb_512']."</a> </td>\n"; echo "</tr></table>\n"; echo "<table width='67%' align='center' border='0' cellpadding='0' cellspacing='0'><tr><td class='cal-blank'>\n"; echo "<table width='100%' align='center' border='0' cellpadding='0' cellspacing='0'><tr bgcolor='#005E00' height='35'>\n"; foreach ($short_days as $key=>$val) { echo "<th style='text-align:center' width='14%'><span style='font-size:12px; color:yellow;'><b>".$val."</b></span></th>\n"; } echo "</tr><tr>\n"; $s=date('w', mktime (0,0,0,$cMonth,1,$cYear)); for ($ds=1; $ds<=$s; $ds++) { echo "<td class='cal-blank' height='35' style='text-align:center;' valign='middle'></td>\n"; } for ($d=1; $d<=$endDate; $d++) { if (date('w',mktime (0,0,0,$cMonth,$d,$cYear)) == 0) { echo "<tr>\n"; } $result = dbquery("SELECT post_id, post_title, post_date FROM ".DB_GRIMS_BLOG_POST." WHERE active='1' AND MONTH(post_date) = '$cMonth' AND DAY(post_date) = '$d'"); $data = dbarray($result); $stuff1 = $data['post_id'] ? $data['post_id'] : ""; if ($stuff1) { $id = $stuff1; } else { $id = ""; } $stuff2 = $data['post_title'] ? $data['post_title'] : ""; if ($stuff2) { $title = $stuff2; } else { $title = ""; } $stuff3 = strtotime($data['post_date']) ? strtotime($data['post_date']) : ""; if ($stuff3) { $evday = $stuff3; } else { $evday = ""; } if (date("d", intval($evday)) == $d) { echo "<td height='35' class='event' align='center' valign='middle'>\n"; } elseif ($d == $day && $cMonth == date('m') && $cYear == date('Y')) { echo "<td height='35' class='today' align='center' valign='middle'>\n"; } else { echo "<td height='35' class='cal-norm' align='center' valign='middle'>\n"; } if ($d == $day && $cMonth == date('m') && $d <> $evday) { echo "<a class='cal2' href='".BASEDIR."grims_blog/filtered.php?post_id=$id' title='".$locale['gb_513']." $title'><b>$d</b></a>\n"; } elseif ($d == $day && $cMonth == date('m') && $d == $evday) { echo "<a class='cal2' href='#'><b>$d</b></a>\n"; } elseif ($evday) { echo "<a class='ecal' href='".BASEDIR."grims_blog/filtered.php?post_id=$id' title='$title'><b>$d</b></a>\n"; } else { echo "<span class='noevt'><b>$d</b></span>\n"; } echo "</td>\n"; if (date('w',mktime (0,0,0,$cMonth,$d,$cYear)) == 6) { echo "</tr>\n"; } } echo "</table></td></tr></table>\n"; echo "</td></tr></table><p></div>\n"; ?> Well I could not add comments to the posted script. These 3 lines of the db query area give the error in my error log: 1) $stuff1 = $data['post_id'] ? $data['post_id'] : ""; /* Trying to access array offset on value of type bool */ 2) $stuff2 = $data['post_title'] ? $data['post_title'] : ""; /* Trying to access array offset on value of type bool */ 3) $stuff3 = strtotime($data['post_date']) ? strtotime($data['post_date']) : ""; /* Trying to access array offset on value of type bool */ I know I am asking a lot for help on older code but would really appreciate it if someone can take a look. Edited April 19 by OldGrimClarify error lines is there a math function that give you an integer value when u divide 2 numbers? ie in 7/3 i just want 2 as a result not floating number. thanks in advance. |