PHP - A Non Well Formed Numeric Value Encountered ..error
Morning !
I've tried a number of things but not able to sort out the error ..anyone see why I am getting the non well formed numeric error?
TIA
Similar TutorialsHi, My errorlog keep spamming the following errormsg: "PHP Notice: A non well formed numeric value encountered on line 365". This is the code it refers to: Code: [Select] for ($yr = $year, $age = -1; mktime(0, 0, 0, $month, $day, (int)$yr) < $today; $yr++, $age++); It's supposed to calculate the owner of the page's age. The full code is: Code: [Select] list($year,$month,$day) = explode("-", $birthday); $tempVar=list($year,$month,$day) = explode("-", $birthday); $today = time(); for ($yr = $year, $age = -1; mktime(0, 0, 0, $month, $day, (int)$yr) < $today; $yr++ Hi, After making an update, I have received this notice: Notice: A non well formed numeric value encountered in -... -on different page on line 128 : <?php $identifier = round(microtime() * 10000000); ?> on line 402 : <?php $identifier = round(microtime() * 10000000); ?> on line 2: <?php $identifier = round(microtime() * 10000000); ?>
How can I fix it? Thanks so much Federica Is there any way to disable the "A non-numeric value encountered" warning in the php.ini file? I don't get that warning on my Apache server but I do when I use the same code on my web host's server. I never got the warning until I uploaded a two line php.ini file to my web host so that I could keep my sessions longer than the default 24 minutes. This is the same online program related to my earlier post about too many inputs. I wanted to try sessions for a 24 hr. period but I'm getting tons of errors for any field that is not used which can be in the hundreds. If I delete my php.ini file from my web host & just let things default to whatever they are using then I don't get those errors, I have a huge application(multi-year) where I do the normal $varX= $var1 + $var2. I get Warning: A non-numeric value encountered because var1 or var 2 are string. I know the right thing will be to intval(), but I just cant go over so much of the application. I read to just disable warning, but I think thats worst because I will not be able to see new warnings. Is there any php.ini solution were php can work as before on math operations? I guess I can ini_set on all the old files and dont do it on the new ones). If there is another accepted solution, please let me know Thank you
I am a new developer, trying to figure out what causing a memory error. The code goes through registered appointments and depends on the service ID, I have to free a 45 minutes for another service to be booked. Now, once I book an appointment for any of the services that can have 45 minutes free spot, the website takes forever to load the hours but doesn't show them, instead I get this error A PHP Error was encountered Severity: Error Message: Maximum execution time of 120 seconds exceeded
foreach ($appointments as $appointment) { foreach ($periods as $index => &$period) { $appointment_start = new DateTime($appointment['start_datetime']); $appointment_end = new DateTime($appointment['end_datetime']); if ($appointment_start >= $appointment_end) { continue; } $period_start = new DateTime($date . ' ' . $period['start']); $period_end = new DateTime($date . ' ' . $period['end']); $serviceId=$appointment['id_services']; $color1=1; $color2=2; $color3=3; $color4=4; $color5=5; $color6=6; $color7=7; $color8=8; $color9=9; $color10=10; $color11=11; $color12=12; $color13=13; $color14=14; $color15=15; $color16=16; $color17=17; $color18=18; $color19=19; $period_s=''; $period_e=''; if ($appointment_start <= $period_start && $appointment_end <= $period_end && $appointment_end <= $period_start) { // The appointment does not belong in this time period, so we will not change anything. continue; } else { if ($appointment_start <= $period_start && $appointment_end <= $period_end && $appointment_end >= $period_start) { // The appointment starts before the period and finishes somewhere inside. We will need to break // this period and leave the available part. //open slot for services 45,45,45 if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // //for the rest of services else { $period['start'] = $appointment_end->format('H:i');} } else { if ($appointment_start >= $period_start && $appointment_end < $period_end) { // The appointment is inside the time period, so we will split the period into two new // others. unset($periods[$index]); if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } //for other services once The code is completely correct else{ $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } } else if ($appointment_start == $period_start && $appointment_end == $period_end) { if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= $appointment_start; $period_s->modify('+45 minutes'); $period_e= $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // //for the rest of services else { unset($periods[$index]);} // The whole period is blocked so remove it from the available periods array. } else { if ($appointment_start >= $period_start && $appointment_end >= $period_start && $appointment_start <= $period_end) { // The appointment starts in the period and finishes out of it. We will need to remove //the time that is taken from the appointment. if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $period['end'] = $appointment_start->format('H:i'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $period['end'] = $appointment_start->format('H:i'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // for the rest of services else{ $period['end'] = $appointment_start->format('H:i'); } } else { if ($appointment_start >= $period_start && $appointment_end >= $period_end && $appointment_start >= $period_end) { // The appointment does not belong in the period so do not change anything. continue; } else { if ($appointment_start <= $period_start && $appointment_end >= $period_end && $appointment_start <= $period_end) { //Open slot for service 45,45,45 if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} else{ unset($periods[$index]); } } } } } } } } } return array_values($periods); } This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=343321.0 Hi all trying to help a friend with a script his installing
but keep getting two errors
Severity: Warning
and
the code being run is
<?php $sql="SELECT * FROM `adminlogin` WHERE role='admin'"; $qry=mysqli_query($sql); $data=mysqli_fetch_array($qry); ?> not sure what I'm doing wrong any help would be appreciated
full page source is
<header id="header-navbar"> <div class="container" > <a style="background-color: #2a3133" href="<?php echo base_url();?>admin/dashboard" id="logo" class="navbar-brand"> <img src="<?php echo base_url();?>upload/taxi_logo.png" alt="" class="normal-logo logo-white" width="100%" height="100%"/> <!-- <img src="img/logo-black.png" alt="" class="normal-logo logo-black"/>--> <!-- <img src="img/logo-small.png" alt="" class="small-logo hidden-xs hidden-sm hidden"/>--> </a> <div class="clearfix"> <button class="navbar-toggle" data-target=".navbar-ex1-collapse" data-toggle="collapse" type="button"> <span class="sr-only">Toggle navigation</span> <span class="fa fa-bars"></span> </button> <div class="nav-no-collapse navbar-left pull-left hidden-sm hidden-xs"> <ul class="nav navbar-nav pull-left"> <li> <a class="btn" id="make-small-nav"> <i class="fa fa-bars"></i> </a> </li> <!-- <li class="dropdown hidden-xs">--> <!-- <a class="btn dropdown-toggle" data-toggle="dropdown">--> <!-- <i class="fa fa-bell"></i>--> <!-- <span class="count">8</span>--> <!-- </a>--> <!-- <ul class="dropdown-menu notifications-list">--> <!-- <li class="pointer">--> <!-- <div class="pointer-inner">--> <!-- <div class="arrow"></div>--> <!-- </div>--> <!-- </li>--> <!-- <li class="item-header">You have 6 new notifications</li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-comment"></i>--> <!-- <span class="content">New comment on ‘Awesome P...</span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-plus"></i>--> <!-- <span class="content">New user registration</span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-envelope"></i>--> <!-- <span class="content">New Message from George</span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-shopping-cart"></i>--> <!-- <span class="content">New purchase</span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-eye"></i>--> <!-- <span class="content">New order</span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item-footer">--> <!-- <a href="#">--> <!-- View all notifications--> <!-- </a>--> <!-- </li>--> <!-- </ul>--> <!-- </li>--> <!-- <li class="dropdown hidden-xs">--> <!-- <a class="btn dropdown-toggle" data-toggle="dropdown">--> <!-- <i class="fa fa-envelope-o"></i>--> <!-- <span class="count">16</span>--> <!-- </a>--> <!-- <ul class="dropdown-menu notifications-list messages-list">--> <!-- <li class="pointer">--> <!-- <div class="pointer-inner">--> <!-- <div class="arrow"></div>--> <!-- </div>--> <!-- </li>--> <!-- <li class="item first-item">--> <!-- <a href="#">--> <!-- <img src="img/samples/messages-photo-1.png" alt=""/>--> <!-- <span class="content">--> <!-- <span class="content-headline">--> <!-- George Clooney--> <!-- </span>--> <!-- <span class="content-text">--> <!-- Look, just because I don't be givin' no man a foot massage don't make it--> <!-- right for Marsellus to throw...--> <!-- </span>--> <!-- </span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <img src="img/samples/messages-photo-2.png" alt=""/>--> <!-- <span class="content">--> <!-- <span class="content-headline">--> <!-- Emma Watson--> <!-- </span>--> <!-- <span class="content-text">--> <!-- Look, just because I don't be givin' no man a foot massage don't make it--> <!-- right for Marsellus to throw...--> <!-- </span>--> <!-- </span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <img src="img/samples/messages-photo-3.png" alt=""/>--> <!-- <span class="content">--> <!-- <span class="content-headline">--> <!-- Robert Downey Jr.--> <!-- </span>--> <!-- <span class="content-text">--> <!-- Look, just because I don't be givin' no man a foot massage don't make it--> <!-- right for Marsellus to throw...--> <!-- </span>--> <!-- </span>--> <!-- <span class="time"><i class="fa fa-clock-o"></i>13 min.</span>--> <!-- </a>--> <!-- </li>--> <!-- <li class="item-footer">--> <!-- <a href="#">--> <!-- View all messages--> <!-- </a>--> <!-- </li>--> <!-- </ul>--> <!-- </li>--> <!-- <li class="dropdown hidden-xs">--> <!-- <a class="btn dropdown-toggle" data-toggle="dropdown">--> <!-- New Item--> <!-- <i class="fa fa-caret-down"></i>--> <!-- </a>--> <!-- <ul class="dropdown-menu">--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-archive"></i>--> <!-- New Product--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-shopping-cart"></i>--> <!-- New Order--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-sitemap"></i>--> <!-- New Category--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- <i class="fa fa-file-text"></i>--> <!-- New Page--> <!-- </a>--> <!-- </li>--> <!-- </ul>--> <!-- </li>--> <!-- <li class="dropdown hidden-xs">--> <!-- <a class="btn dropdown-toggle" data-toggle="dropdown">--> <!-- English--> <!-- <i class="fa fa-caret-down"></i>--> <!-- </a>--> <!-- <ul class="dropdown-menu">--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- Spanish--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- German--> <!-- </a>--> <!-- </li>--> <!-- <li class="item">--> <!-- <a href="#">--> <!-- Italian--> <!-- </a>--> <!-- </li>--> <!-- </ul>--> <!-- </li>--> <!-- <span class="conveythis notranslate" translate="no"><a href="http://translation-services-usa.com/spanish.php" title="spanish translation services" class="conveythis-image conveythis-drop translate1">spanish translation services</a></span><script src="http://s1.conveythis.com/e4/javascript/e.js?conveythis_src=en"></script>--> </ul> </div> <div class="nav-no-collapse pull-right" id="header-nav"> <ul class="nav navbar-nav pull-right"> <li class="mobile-search"> <a class="btn"> <i class="fa fa-search"></i> </a> <div class="drowdown-search"> <form role="search"> <div class="form-group"> <input type="text" id="example1" class="form-control" placeholder="Search..."> <i class="fa fa-search nav-search-icon"></i> </div> </form> </div> </li> <?php $sql="SELECT * FROM `adminlogin` WHERE role='admin'"; $qry=mysqli_query($sql); $data=mysqli_fetch_array($qry); ?> <li class="dropdown profile-dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <img src="<?php echo base_url().$data['image']; ?>" alt=""/> <span class="hidden-xs"><?php echo $data['username'];?></span> <b class="caret"></b> </a> <ul class="dropdown-menu dropdown-menu-right"> <li><a href="profile"><i class="fa fa-user"></i>Profile</a></li> <li><a href="password_change"><i class="fa fa-cog"></i>Change Password</a></li> <!-- <li><a href="#"><i class="fa fa-envelope-o"></i>Messages</a></li>--> <li><a href="logout"><i class="fa fa-power-off"></i>Logout</a></li> </ul> </li> <li class="hidden-xxs"> <a class="btn" href="logout"> <i class="fa fa-power-off"></i> </a> </li> </ul> </div> </div> </div> </header>
I am getting this error on my sales cart page. I am editting a PHP Point of sale program. Cant work out why this is not working. It should display the amount of points the item is worth. Help please Heres the error im getting: A PHP Error was encountered Severity: Notice Message: Undefined index: points Filename: sales/register.php Line Number: 69 Heres the code: <div class='warning_message' style='padding:7px;'><?php echo $this->lang->line('sales_no_items_in_cart'); ?></div> </tr></tr> <?php } else { foreach($cart as $item_id=>$item) { echo form_open("sales/edit_item/$item_id"); ?> <tr> <td><?php echo anchor("sales/delete_item/$item_id",'['.$this->lang->line('common_delete').']');?></td> <td><?php echo $item['name']; ?></td> !!!THIS IS LINE 69 !!! <td><?php echo $item['points']; ?></td> <?php if ($items_module_allowed) { ?> <td><?php echo form_input(array('name'=>'price','value'=>$item['price'],'size'=>'6'));?></td> <?php } else { ?> <td><?php echo $item['price']; ?></td> <?php echo form_hidden('price',$item['price']); ?> <?php } ?> <td><?php echo form_input(array('name'=>'quantity','value'=>$item['quantity'],'size'=>'2'));?></td> <td><?php echo form_input(array('name'=>'discount','value'=>$item['discount'],'size'=>'3'));?></td> <td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td> <td><?php echo form_submit("edit_item", $this->lang->line('sales_edit_item'));?></td> </tr> </form> Any ideas? Hey, So what im trying to do is put my database variables into a session array. So this is what im trying to accomplish... $_SESSION['Name_of_Row'] = $value This is the script I wrote: Code: [Select] Function setupSession(){ session_start(); $query = "SELECT * FROM users WHERE u_id ='{$this->u_id}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); foreach($row as $key => $value){ if(!empty($value)){ $_SESSION[$key] = $value; } } } When that runs I get the following warning. Can anyone tell me what this means and how to fix it? Error: Notice: Unknown: Skipping numeric key 0 in Unknown on line 0 I have three files: Quote /index.php /include/index.php /include/ajax.php the /index.php page is the landing page, which includes the file /include/index.php once the page loads, I make ajax calls to /include/ajax.php here is what the files basically looks like: index.php <html><body><? include('include/index.php'); ?></body></html> include/index.php <? session_start() unset($_SESSION['team']); $_SESSION['team'] = '9'; include/ajax.php <? session_start() $_SESSION['team'] = $_SESSION['team'] . ',9'; Pretty simple right? However, here is what is happening, every time I make a call ajax call to /include/ajax.php, the code in /include/index.php also gets executed and team is reset to 9! I am using jquery to make the ajax call: Code: [Select] $("input:radio").live('click', function() { $.ajax( { url:'include/ajax.php', success: function (data) { alert('done'); } }); }); and when I view the value after each ajax call, it is set to just 9. This is not any other issue, other than the code in include/index.php being executed each time the ajax function is called. Why in the world is the code in include/index.php being execute?! Under what circumstance would such a thing occur? ok what in the world is going on here... I have a simple javascript code to switch out the text between a div there are 4 rotations the text that is being switched is populated from my DB using php. now the weird part. in my DB i'm using longtext now If the text in the db is all one paragraph everything works fine but if there is any type of line break or new paragraph the script wont rotate at all. any ideas? I use a simple machines forum and want to combine a table I have and a smf table and I need the dates in a numberic format(like smf uses). Sooo ... how do I get the time in a format like this 1336392447 Thanks Hi, I have a page that lists the names of the Artists in one column, and the title of their song in the next column. I've included a sort section that allows users to view the artist (with the corresponding title) that starts with whatever letter they press. I've now come to a point where I need to add in a check for numbers. (View attached image to understand what we're talking about) So if the artist name starts with any number between 0-9, it will be shown in order on the page once a user clicks on "#". I've tried doing it various ways, but can't seem to get it just right. Here is the code (I took out all my attempts to get the numeric sort working): <?php session_start(); include_once('inc/connect.php'); if (isset($_SESSION['username'])){ $loginstatus = "logout"; } else{ $loginstatus = "login"; } if(!isset($_SESSION['sort_counter'])) {$_SESSION['sort_counter'] = 1;} if(($_SESSION['sort_counter']%2) == 0){ //test even value $sortcount = "DESC"; }else{ //odd value $sortcount = ""; } $result = mysql_query("SELECT * FROM sheets ORDER BY artist"); $sheetscount = mysql_num_rows($result); $sortletteris = $_GET['letter']; $downloadclick = $_GET['downloadclick']; $show = $_GET['show']; $today = date("Y-m-d"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="styles/style.css" /> </head> <body bgcolor="#343331"> <!-- Header --> <div id="header"> <div id="headerleft"></div> <div id="headermiddle"><a href="index.php"><img src="img/logo.png"></a></div> <div id="headerright"> </div> </div> <!-- Content Top --> <div id="contenttop"> <div id="links"> <!-- 92x30 --> </div> </div> <!-- Content Middle --> <div id="contentmiddle"> <div id="content"> <div id="sort"> <?php echo "<center>".$sheetscount." Sheets Available<br />"; echo "<a href='newlyadded.php'>New Sheets</a><span> | </span><a href='request.php'>Request a Sheet</a></center>"; $letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; echo "<center><div id='letters'>"; $i = 0; while ($i<26){ $sortletter = $letters[$i]; echo "<a href='index.php?letter=".$i."'>".$letters[$i]." </a>"; $i += 1; } echo " <a href='index.php'>All</a></div></center>"; if (($sortletteris)!=""){ // The letter that was clicked is set to this variable $mysortletter = $letters[$sortletteris]; //echo $mysortletter; // lname LIKE '$letter%' $result = mysql_query("SELECT * FROM sheets WHERE artist REGEXP '^[$mysortletter]' ORDER BY artist $sortcount"); $_SESSION['sort_counter'] = $_SESSION['sort_counter'] + 1; //increment after every run } elseif (($sortletteris)==""){ $result = mysql_query("SELECT * FROM sheets ORDER BY artist $sortcount"); $_SESSION['sort_counter'] = $_SESSION['sort_counter'] + 1; //increment after every run } $greenboxleft = "greenboxleft"; $greenboxright = "greenboxright"; $grayboxleft = "grayboxleft"; $grayboxright = "grayboxright"; $colorvalue = 0; echo "<br /><table width='600px' align='center' style='border-collapse:separate; border-spacing:0px;'><th style='background-color: #cccccc; border-bottom-style: solid; border-color: #6aa504;'>Artist</th><th style='background-color: #cccccc; border-bottom-style: solid; border-color: #6aa504;'>Title</th>"; while($row = mysql_fetch_array($result)) { if(($colorvalue%2)==0){ $styleleft = $greenboxleft; $styleright = $greenboxright; } else{ $styleleft = $grayboxleft; $styleright = $grayboxright; } echo "<tr>"; echo "<td align='center' width='250' id='$styleleft'><div id='songsboxleft'>". ucwords($row['artist']). "</div></td>"; echo "<td align='center' width='250' id='$styleright'><div id='songsboxright'><a target='_blank' name='downloadclick' href='".$row['url']."'>" .ucwords($row['title']). "</a></div></td>"; echo "</tr>"; $colorvalue++; } echo "</table>"; ?> </div> </div> </div> <!-- Content Bottom --> <div id="contentbottom"> </div> </body> </html> Looking for ideas and advise on this one. I want to take a 10 digit number and 1234567890 and format it like 132-456-7890 what would be my best bet as choice of methods to do this? Is there an easy way to find a numeric value in a string if I don't know what the string will contain? For example I want '52' out of: mystring52 Hopefully there is already a simple function to do this? I'm thinking there may not be as the string having more than one group of numbers may confuse matters. I'm just dealing with abcdef123 or similar in this case though. I have a text firld to enter amount af a book,But i need to check whether the data entering is numeric only eg:70.98 etc. how can i achieve this. my code is echo"<table><tr><td></td><td>Amount in USD</td><td></td><td><input type='text' name='amnt' id='amnt' /> </td><td></td></tr></table>"; Hey Guys...I am trying to secure my php file and have been reading a lot regarding sql injection. I still dont understand clearly how to prevent sql injection through numeric data input, since from what I understood mysql_real_escape_string() does nothing about it only prevents attacks on string input. Here's an example: if ($action == "checkId") { //retreive data from flash $user_id=mysql_real_escape_string($_POST['Id']); $result = mysql_query("SELECT user_id from users WHERE user_id = '$user_id'"); if (mysql_num_rows($result) > 0) { echo "status1=exists"; } else { echo "status1=id doesnt exist"; } } I would like to create a function like this: foreach($_POST as $post) { $postvars[$key] = htmlentities($post); //XSS prevention $postvars[$key] = mysql_real_escape_string($post); //Sql String Prevention } But then again...How do I check on the numeric POST's ? how do I validate them through this function? Any suggestions and/or ideas? Thanks a lot in advance! Cheers. Anyone know how to cast arabic numeric input to (int) ? Or how to convert arabic numerals to english numerals? I created an auction website, inputting english numbers seems to work. However when I switch languages to Arabic, it doesn't work. By casting any arabic numeral input to (int) It keeps returning 0. ١٢٣٤٥٦٧٨٩ 123456789 Hi. I want to build a SQL string based on my form fields so when I have a new field in the db, I can just add a new form field and the sql update will automatically work. For example I have:
<input type=text name=t_something> <input type=text name=d_something> <input type=text name=n_something>(post submission) $data = array(); foreach ($_REQUEST AS $key=>$val) { if (substr($key, 0, 2) == "t_") $data[substr($key, 2, strlen($key)-2)] = $val; if (substr($key, 0, 2) == "n_") $data[substr($key, 2, strlen($key)-2)] = (trim($val)==""?"0":$val); if (substr($key, 0, 2) == "d_") $data[substr($key, 2, strlen($key)-2)] = (trim($val)==""?"NULL":date("Y-m-d", strtotime($val)); } $data["posted"] = "NOW()"; $sql = "INSERT INTO table ("; $cnt = 0; foreach ($data AS $key=>$val) { $cnt++; $sql .= $key . (($cnt < count($data))?", ":""); } Below is my code... I'm new to OOP so forgive me if it's poorly designed. What i'm trying to do is make sure that asset_key never get's duplicated. So when time comes to insert a new record, i can rest assures that asset_key will not duplicate. For some reason $random_number never get's back a value; Code: [Select] <?php class Randomize { function createRN() { $num = rand(100000,999999); $sql = "SELECT * FROM mer_asset_header WHERE asset_key = '$num'"; $go = oci_parse($conn, $sql); oci_execute($go); $count = oci_num_rows($go); if($count = 1) $repeat = Randomize::createRN(); else return $num; } } $random_number = new Randomize; $random_number->createRN(); ?> I should also mention, that if the query finds that asset_key, it should also run createRN() again untill it gets a unique one. Thanks for the help in advance! |