PHP - Unexpected T_lnumber - - Help With Syntax Sql
If anyone can help find the issue here.. I would much appreciate it! Also, if you see anything whacked out, please feel free to point that out (esp the CASE WHEN as I'm looking to do a IF THEN in the WHERE to show ALL records if no choice is made by user)
ERROR: Parse error: syntax error, unexpected T_LNUMBER in /home/ubas..... port/public_html/modules/mod_php/mod_php.php(36) : eval()'d code on line 59 Code: [Select] Upcoming Schedule <form action="" method="post"> <select name="team_id"> <option value="33" selected="selected">default pick</option> <option value="999">team 999</option> <option value="11">team 11</option> <option value="22">team 22</option> </select> <br><br> <input type="Submit"> </form> // FROM HERE <?php $team_id = JRequest::getVar('team_id'); $username=xx; $password="sss"; $database="5555"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT uba_teams.team_coach, uba_teams.team_name, uba_schedule.sch_date, uba_schedule.game_location, uba_schedule.game_time, uba_schedule.opp_name FROM uba_schedule INNER JOIN uba_teams ON uba_schedule.team_id = uba_teams.team_id WHERE (uba_schedule.sch_uba_score IS NULL) AND (CASE $team_id WHEN 999 THEN uba_teams.team_id ELSE uba_teams.team_id = $team_id END) ORDER BY uba_schedule.sch_date ASC $result=mysql_query($query); $num=mysql_numrows($result); ?> <table border="2" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">player_id</font></th> <th><font face="Arial, Helvetica, sans-serif">first</font></th> <th><font face="Arial, Helvetica, sans-serif">last</font></th> <th><font face="Arial, Helvetica, sans-serif">age group</font></th> <th><font face="Arial, Helvetica, sans-serif">game id</font></th> <th><font face="Arial, Helvetica, sans-serif">coach name</font></th> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"uba_teams.team_coach"); $f2=mysql_result($result,$i,"uba_teams.team_coach"); $f3=mysql_result($result,$i,"uba_teams.team_coach"); $f4=mysql_result($result,$i,"uba_teams.team_coach"); $f5=mysql_result($result,$i,"uba_teams.team_coach"); $f6=mysql_result($result,$i,"uba_teams.team_coach"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td> </tr> <?php $i++; } ?> Similar TutorialsHi, I have a basic php code that allows the user to search and display data from a database. I have searched and searched the entire code for errors, but I cannot find any. When I try to run the code (do a search) it gives me this error: Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' on line 99 This is my line 99: echo ' <a href="'.$_SERVER['PHP_SELF']."?s=$news&q=$var\">Next 10 >></a>"; and this is my whole code: <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","xxxxxx","xxxxx"); mysql_select_db("xxxxxx") or die("Unable to select database"); // Build SQL Query $query = "SELECT lastname, firstname, state, zip, jobtype, otherjobtype, nightavail, weekendavail, ptft, objective, resume FROM data WHERE jobtype LIKE '%" . $trimmed . "%' ORDER BY lastname"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; echo "<p><a href='http://www.google.com/search?q=". $trimmed . "' target='_blank' title='Look up " . $trimmed . " on Google'>Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $title = $row["1st_field"]; echo "$count.) $title" ; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { $prevs=($s-$limit); print ' <a href="'.$_SERVER['PHP_SELF'].'?s=$prevs&q=$var"><< Prev 10</a>  '; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo ' <a href="'.$_SERVER['PHP_SELF']."?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> I am completely new to php. If anyone could give me a hint I'd greatly appreciate it... Hi, I can't figure out what I'm doing wrong because I don't understand why I'm getting... Parse error: syntax error, unexpected T_LNUMBER in /home/leke/public_html/test/forum/registration_script.php on line 37 ...which the php manual is to do with integers. Line 37 is: Code: [Select] if ( ( strlen($username) < 2 || strlen($username) > 26 ) ) { Code: [Select] $username = $_POST['userName']; // Wrong username length? if ( ( strlen($username) < 2 || strlen($username) > 26 ) ) { echo '<p class="fail">Username must be between 2-26 characters long.</p>'; exit; } Is there a problem on that line? Thanks. Hey guys, me again, minor syntax error, can't seem to resolve it. Says it's on line 61, this code snippet is line 61. If ($page == ceil($numofpages) && $page != 1) { Thanks! can someone please help me, I get syntax error, unexpected '[' in my page here is my code: Code: [Select] $query1 = "SELECT * FROM members WHERE rsUser = '".$rsUser."' AND rsPass = '".$rsPass."'"; $result1 = mysql_query($query1); $row1 = mysql_fetch_array($result1); $_SESSION['USERID']=row1['USERID']; $_SESSION['RSPOSTCODE']=row1['RSPOSTCODE']; $_SESSION['RSEMAIL']=row1['RSEMAIL']; $_SESSION['RSUSER']=row1['RSUSER']; $pSQL = "INSERT INTO favepub_COPY (USERID,PUBID)" $pSQL = $pSQL."SELECT ".$_SESSION["USERID").", PUBID " $pSQL = $pSQL."FROM pubs " $pSQL = $pSQL."WHERE left(rsPostCode,4) = '".$_SESSION["RSPOSTCODE")."'" Can you help me with this piece of code? i receive the following error message: syntax error, unexpected '<' Code: [Select] <?php function left($value,$NbChar) { return substr($value,0,$NbChar); } function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); } function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); } function RaiseError($Message) { ?> <?php <DIV STYLE='font-family: Tahoma; font-size: 11px; color: #000000'><BR> <IMG SRC='error.gif' WIDTH=9 HEIGHT=9> <?php echo $Message; ?></DIV> </BODY> </HTML> } ?> My regexp has an error, and I can't figure out where it is coming from. Parse error: syntax error, unexpected '.' in /home/ryannaddy/tutorials.phpsnips.com/incl/classes/Main.inc.php(87) : regexp code on line 1 $string = preg_replace("/\[code\](.+)\[\/code\]/isUe", "'<span class=\"exampletxt\">EXAMPLE:</span><div class=\"code\">'.str_replace('<br />','',$1).'</div>';", $string); How would I fix that? I'm having an issue with a small bit of code I'm writing for a class. Below is the code I have and at line 30, dreamweaver gives me the error "syntax error, unexpected $end" <!DOCTYPE html> <html lang="en-US"> <head> <title>Homework 2 - Simple PHP page</title> </head> <body> <?php if($_POST['firstName'] == NULL || $_POST['quantity'] == NULL || $_POST['gender'] == NULL || $_POST['sport'] == NULL) { echo "<h1>Please return to the form and fill out completely</h1>"; } else { ?> <?php echo "<h2>Welcome ".$_POST["firstName"]."</h2>"; if($_POST['gender']=='male' &$_POST['sport']=='gymnastics') { echo " Real men don't like gymnastics!<br/>"; } else if($_POST['gender']=='female' &$_POST['sport']=='football') { echo "Women are too delicate for a rough sport like football!<br/>"; } $cost = $_POST['quantity'] * 4.95 * 1.08 + 5.99; ?> *LINE 30* <p>You have ordered <?php echo $_POST['quantity'] . " " . $_POST['sport'] . " mugs at a cost of $" . number_format($cost, 2); ?>. Thank you.</p> <p> } </body> </html> I can't seem to figure out what I've done wrong, any help would be appreciated, thank you. im trying to create a basic login page and after checking username and password and navigating to next page i get this error on the page it suppose to navigate to and the section of code its referring too Parse error: syntax error, unexpected token ";" in C:\xampp\htdocs\bubbleandbalm\index.php on line 4 <?php session_start(); if(isset($_SESSION['id']) && (isset($_SESSION['user_name'])){ ?> this is the full code for that page aswell
<?php session_start(); if(isset($_SESSION['id']) && (isset($_SESSION['user_name'])){ ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" > <title>RedStore | Ecommerce Website Design</title> <link rel="stylesheet" href="style.css"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;500;600;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css"> </head> <body> <div class="header"> <div class="container"> <div class="navbar"> <div class="logo"> <img src="images/logo.png" width="125px"> </div> <nav> <ul id="MenuItems"> <li><a href="">Home</a></li> <li><a href="">Products</a></li> <li><a href="">About</a></li> <li><a href="">Contact Us</a></li> <li><a href="">Account</a></li> </ul> </nav> <img src="images/cart.png" width="30px" height="30px" > <img src="images/menu.png" class="menu-icon" onclick="menutoggle()"> </div> <div class="row"> <div class="col-2"> <h1>Give Your Workout<br>A New Style?</h1> <p>Success isnt always about greatness. It's about consistency. consistent<br>hard work gains success, Greatness will come. </p> <a href="" class="btn">Explore Now →</a> </div> <div class="col-2"> <img src="images/image1.png"> </div> </div> </div> </div> <!--featured categories--> <div class="categories"> <div class="small-container"> <div class="row"> <div class="col-3"> <img src="images/category-1.jpg"> </div> <div class="col-3"> <img src="images/category-2.jpg"> </div> <div class="col-3"> <img src="images/category-3.jpg"> </div> </div> </div> </div> <!--featured products--> <div class="small-container"> <h2 class="title">Featured Products</h2> <div class="row"> <div class="col-4"> <img src="images/product-1.jpg"> <h4>Red Printed T-Shirt</h4> <p>£25.00</p> </div> <div class="col-4"> <img src="images/product-2.jpg"> <h4>Red Printed T-Shirt</h4> <p>40.00</p> </div> <div class="col-4"> <img src="images/product-3.jpg"> <h4>Red Printed T-Shirt</h4> <p>£30.00</p> </div> <div class="col-4"> <img src="images/product-4.jpg"> <h4>Red Printed T-Shirt</h4> <p>£20.00</p> </div> </div> <!--latest products--> <h2 class="title">Latest Products</h2> <div class="row"> <div class="col-4"> <img src="images/product-5.jpg"> <h4>Red Printed T-Shirt</h4> <p>£25.00</p> </div> <div class="col-4"> <img src="images/product-6.jpg"> <h4>Red Printed T-Shirt</h4> <p>40.00</p> </div> <div class="col-4"> <img src="images/product-7.jpg"> <h4>Red Printed T-Shirt</h4> <p>£30.00</p> </div> <div class="col-4"> <img src="images/product-8.jpg"> <h4>Red Printed T-Shirt</h4> <p>£20.00</p> </div> <div class="row"> <div class="col-4"> <img src="images/product-9.jpg"> <h4>Red Printed T-Shirt</h4> <p>£25.00</p> </div> <div class="col-4"> <img src="images/product-10.jpg"> <h4>Red Printed T-Shirt</h4> <p>40.00</p> </div> <div class="col-4"> <img src="images/product-11.jpg"> <h4>Red Printed T-Shirt</h4> <p>£30.00</p> </div> <div class="col-4"> <img src="images/product-12.jpg"> <h4>Red Printed T-Shirt</h4> <p>£20.00</p> </div> </div> </div> </div> <!--offer--> <div class="offer"> <div class="small-container"> <div class="row"> <div class="col-2"> <img src="images/exclusive.png" class="offer-img"> </div> <div class="col-2"> <p>Exclusively Available on RedStore</p> <h1>Smart Band 4</h1> <small>TheMi Smart Band 4 features a 39.9% larger AMOLED color full-touch display with adjustable brightness, so everything is clear as can be. </small> <a href="" class="btn">Buy Now →</a> </div> </div> </div> </div> <!--Brands--> <div class="brands"> <div class="small-container"> <div class="row"> <div class="col-5"> <img src="images/logo-godrej.png"> </div> <div class="col-5"> <img src="images/logo-oppo.png"> </div> <div class="col-5"> <img src="images/logo-coca-cola.png"> </div> <div class="col-5"> <img src="images/logo-paypal.png"> </div> <div class="col-5"> <img src="images/logo-philips.png"> </div> </div> </div> </div> <!--footer--> <div class="footer"> <div class="container"> <div class="row"> <div class="footer-col-1"> <h3>Download Our App</h3> <p>Download Appfor Android<br>and IOS mobile phone.</p> <div class="app-logo"> <img src="images/play-store.png"> <img src="images/app-store.png"> </div> </div> <div class="footer-col-2"> <img src="images/logo-white.png"> <p>Our purpose is to sustainably make the pleasure and<br>benefits of sports accessible to the many.</p> </div> <div class="footer-col-3"> <h3>Useful Links</h3> <ul> <li>Coupons</li> <li>Blog Posts</li> <li>Return Policy</li> <li>Join Affiliate</li> </ul> </div> <div class="footer-col-4"> <h3>Follow Us</h3> <ul> <li>Facebook</li> <li>Twitter</li> <li>Instagram</li> <li>Youtube</li> </ul> </div> </div> <hr> <p class="copyright">Copyright 2021 - Easy Tutorials</p> </div> </div> <!--js for toggle menu--> <script> var MenuItems = document.getElementById("MenuItems"); MenuItems.style.maxHeight = "0px"; function menutoggle(){ if(MenuItems.style.maxHeight == "0px"){ MenuItems.style.maxHeight = "200px"; } else{ MenuItems.style.maxHeight = "0px"; } } </script> </body> </html> <?php } else{ header("Location: account.php"); exit(); } ?> my login in page <?php session_start(); include "db_conn.php"; if (isset($_POST['uname']) && isset($_POST['password'])){ function validate($data){ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $uname = validate($_POST['uname']); $pass = validate($_POST['password']); if(empty($uname)){ header("Location: account.php?error=User Name is required"); exit(); } else if (empty($pass)){ header("Location: account.php?error=Password is required"); exit(); } else{ $sql = "SELECT * FROM login WHERE user_name = '$uname' AND password = '$pass'"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) === 1){ $row = mysqli_fetch_assoc($result); if($row['user_name'] === $uname && $row['password'] === $pass){ $_SESSION['user_name'] = $row['user_name']; $_SESSION['name'] = $row['name']; $_SESSION['id'] = $row['id']; header("Location: index.php"); exit(); } else{ header("Location: account.php?error=Incorrect username or password"); exit(); } } else{ header("Location: account.php?error=Incorrect username or password"); exit(); } } } else{ header("Location: account.php"); exit(); } ?> db_conn page <?php $sname = "localhost"; $uname = "root"; $password = ""; $db_name = "users"; $conn = mysqli_connect($sname,$uname,$password, $db_name); if (!$conn){ echo "Connection failed!"; } ?>
if(mysql_num_rows($query) == 1) { $compny = mysql_query("SELECT * FROM company WHERE value='". $comp ."'"); $company = mysql_result($compny, 0); if(mysql_num_rows($company) == 0) { echo "Company not found"; die(); } $getcompstt = mysql_query("SELECT stat FROM company WHERE value='". $comp ."' LIMIT 1"); $getcompstat = mysql_result($getcompstt, 0); elseif($getcompstat == "3")
Hello, I need your help, please. It's about my Wordpress website. As soon as I try to access the website, I get this error message: "Parse error: syntax error, unexpected '<' in /homepages/38/d595304200/htdocs/clickandbuilds/VILLAMCGermany/wp-content/plugins/ccode.php on line 155".
<?php
?> Easy one i hope... Heres my array: echo "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>"; echo "<TR />"; echo "<TD WIDTH=30% VALIGN=TOP />"; echo " <IMG SRC=$row['CarPrice]/> "; <----- THIS IS LINE 66 THAT THE ERROR APPEARS ON!! echo "<br />"; echo "</TD>"; echo "<TD WIDTH=10 VALIGN=TOP />"; echo " "; echo "</TD>"; echo "<TD />"; echo "<font size=3 face=arial /><B >"; echo $row['CarPrice']; echo "</B><font size=2 face=arial />"; echo "<br />"; echo $row['CarTitle']; echo "<br />"; Have i encased the $row['photo'] properly? I'm getting a syntax error in this code. Basically I'm printing out a form, and depending on the value of an option, I want "checked" to be printed out. I was getting a syntax error by using the non-shorthand version of an if statement too. Any ideas why? '<input type="radio" name="position" value="1" '.(get_option("shPosition") == 1 ? echo "checked" :).' /> Top <input type="radio" name="position" value="0" '.(get_option("shPosition") == 0 ? echo "checked" :).' /> Bottom' Hello all I am getting an error Parse error: syntax error, unexpected T_VARIABLE with this line: $isql = oci_parse($conn, 'INSERT INTO "useridA" VALUES ('$userid')'); Any through? Thanks! I have gone over this and over it and I can't find the syntax error. Perhaps another set of eyes will find it. :) $sql="UPDATE product SET title='$item_title', description='$item_description', price='$item_price', ship_to='$item_ship_to', shipping_cost='$item_shipping_cost', international='$item_international', in_location='$item_in_location', in_shipping='$item_in_shipping', country='$item_country', city='$item_city', state='$item_state', sub_id='$item_sub_id', cat_id='$item_cat_id', date=NOW(), exp_date=DATE_ADD(NOW()INTERVAL 59 DAY), relist_date=DATE_ADD(NOW(),INTERVAL 45 DAY), image_upload_box='$item_image_upload', thumb='$item_thumb', artist_email='$artist_email' WHERE id = '"$_GET['id']'"; Hi, I am new to linux and was trying my first experience using cygwin on Windows 7. I am trying to run the following simple script named parsescript3 in the home directory and keeps getting the error 'syntax error near unexpected token `(''. Can anyone please help and let me know what is exactly wrong with the syntax?
~/bin/parsescript3 content
#!/bin/bash
FOR /F "TOKENS=1,2 DELIMS=," %%A IN ("serverA,D") DO @ECHO %%A %%B
Execution and output on cygwin64:
~/bin
$ ./parsescript3
./parsescript3: line 3: syntax error near unexpected token `('
./parsescript3: line 3: `FOR /F "TOKENS=1,2 DELIMS=," %%A IN ("serverA,D") DO @ECHO %%A %%B'
Well sorry to bother you guys with this seemingly stupid problem. I have a file hmgc.php from a friend, and I try to modify the codes myself to add some sort of features to my site. Unfortunately, I am unable to proceed because of this error: Quote Parse error: syntax error, unexpected T_STRING in /home7/pkmnhofc/public_html/adoptables/hmgc.php on line 115 The file is attached in this message already, please take a look at it and tell me what exactly was wrong? I tried to add another if-elseif-else statement within an else statement, may this be a problem? Also this is the scripts around line 115 looks like: if($act == "2"){ $query = "SELECT * FROM ".$prefix."user_inventory WHERE item_owner='$loggedinname' and item_name='Old Rod'"; $result = mysql_query($query); $num = mysql_numrows($result); if($num == 0){ $article_title = "Oops it appears that you do not have an Old Rod yet..."; $article_content = "<center><table style='color: #FFFF31; background: Green; width: 400px; border: 1px solid #9BDDFF;'><tr><td> It seems that you do not have an Old Rod in your inventory yet, are you sure it is the best choice for you to fish without a rod?<br><br> To fix this issue, simply go back and take Fishing Quiz. You syhould be able to acquire an Old Rod for yourself if you answer all these questions successfully. Trust me, they aint really hard at all if you know something about pokemon and the fishing mechanism already.<br> <br><a href='fishingquiz.php'>Take the Fishing Quiz now!!!</a> } else{ $randnum1 = rand(1, 500); if($randnum1 >= 1 and $randnum1 < 225){ $article_title = "You got a Magikarp"; $article_content = "<center><table style='color: #b60400; background: black; width: 400px; border: 1px solid #b60400;'><tr><td><br><br> Now is your chance to adopt a wild Magikarp!</td></tr></table></center>"; } else if($randnum1 >= 225 and $randnum1 < 250){ $article_title = "You got a Goldeen"; $article_content = "<center><table style='color: #b60400; background: black; width: 400px; border: 1px solid #b60400;'><tr><td><br><br> Now is your chance to adopt a wild Goldeen</td></tr></table></center>"; } else{ $article_title = "Not even a bite"; $article_content = "<center><table style='color: #b60400; background: black; width: 400px; border: 1px solid #b60400;'><tr><td><br><br> Too bad you got nothing...</td></tr></table></center>"; } } } Thank you so much for reading this thread, I appreciate it a lot. When I try to run a program, I am getting an error message. Not sure why and the code that has the error is shown below. Error message is syntax error, unexpected T_STRING setcookies("username","$username",time()+86400); Hi everyone,
I am fairly new to PHP coding, and I am attempting to write a script that reads entries from a contact entry from and adds them to a database. However I keep receiving an error that states:
" Parse error: syntax error, unexpected 'name' (T_STRING), expecting ']' in C:\wamp\www\it665\addContact.php on line 16"
I have been trying to figure out what I am missing, or need to remove, and I am having the hardest time. Below is the entire code for the addContact.php script that I keep receiving this error for. I would really appreciate any feedback.
<?php Blast, final error in my script,not sure how to resolve, the code snippet below is the line in error. Thanks for your help! echo "<a href="\"/{$i}\">{$i}</a>"; |