PHP - Moved: Why Doesn't This Code Work? I Want To Send Parameters From Php To A Perl Script
This topic has been moved to Other Programming Languages.
http://www.phpfreaks.com/forums/index.php?topic=312147.0 Similar TutorialsThis topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=355562.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321864.0 Hi everybody! I'm creating a site and none of my php-code works. I tried to do a simple php-code to test it but it doesn't work either. The simple php-code: <?php echo "hello"; ?> Hi guys, When I insert the following code I get the parsing error "unexpected $end": Code: [Select] <?PHP if(isSet($_GET['sid'])) { $con = mysql_connect("localhost","YYYYY", "XXXXX"); if (!$con) {die('Could not connect: ' . mysql_error("oop")); mysql_select_db("YYYYY_testDB") or die(mysql_error()); $totalresult = mysql_query("SELECT * FROM QANDATable"); $num_rows = mysql_num_rows($totalresult); $limit; $counter = 1; while($counter < mysql_num_rows($totalresult)){ $result = mysql_query("SELECT * FROM QANDATable WHERE id = $counter"); $row = mysql_fetch_array($result); echo $row['TSuperQuestion']; if(isSet($_GET['sid'])){ echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";} echo $row['TQuestion']; echo $row['TAnswer']; $counter++;} } else { echo "<h2>Enter Student Number:</h2>"; echo '<form name="input" action="./Code-sandbox.php" method="GET">'; echo '<input type="text" name="sid"/>'; echo '<input type="submit" value="Submit">'; echo '</form>'; } ?> The code worked before I inserted: Code: [Select] if(isSet($_GET['sid'])){ echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";}Any idea what is wrong here? I am using this PHP code with a MySQL query. PHP parses the PHP fine, but the MySQL query is not having any effect on the database. Can anyone see an error in my code? I can't. $query = "UPDATE `products` set `id` = '".$_POST['id']."' where `id` = '".$_POST['id']."'"; MOD EDIT: Changed PHP manual link tags to [php] . . . [/php] tags. Hello, The following is my situation where I seem to get a 500 error code from the linux server: i have an 'index' file like this: Code: [Select] <?php require("includes/config.php"); $a = $_REQUEST['a']; switch ($a) { case "home": include("frontpage/main.php"); case "user-process": include("user-process.php"); } ?> config.php is something like this: Code: [Select] <?php require(includes/classes/session.class.php); require(includes/classes/user.class.php); require(includes/classes/db.class.php); ... ?> Now if we fall into the case "home" it works fine. Instead, if we fall into user-process it writes to the logs file Fatal Error: Class User does not exist bla bla bla. Why doesn't it exist ? every class is included in the config.php file then index.php includes first config.php ( which has all the classes) and then includes the requested page. I also have a .htaccess file which is as follows: Code: [Select] RewriteEngine On RewriteRule ^([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7 [NC,L] which is used to access in a SEO friendly way the pages that users request. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347725.0 Hello everyone, I'm having this problem which is really annoying, tried to solve it but couldn't, I write that code in PHPMyAdmin and it works great, but it doesn't work in the website it self ok long story short, there are three tables, hotels, cities, countries hotels include in addition to hotel info, 2 columns (city_id) and (country_id) Cities include id and name and also countries include id and name what I was trying to do, that when a person inputs a city or country name in the search form, it should get the hotels that exists in this city or country, but unfortunately it shows all the hotels in all cities and countries, although the pagination code for number of pages works just fine, it count the number of hotels in that city or country and show the number of pages correctly so here is the code for both for hotel search Code: [Select] class hotelManager { public function getHotel($where) { $where = isset($_POST['where']) ? $_POST['where'] : ""; $dbObj = new DB(); $sql = "select * from hotels where city_id = (select id from cities where name = '$where' ) or country_id = (select id from countries where name = '$where' )"; $result = MYSQL_QUERY($sql); $arr = array(); echo "<table>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td valign=\"top\" width=\"120px\">"; $rowid = $row['id']; $imageqry=mysql_query("SELECT * FROM `hotelphotos` where hotel_id='$rowid' LIMIT 1"); $image=mysql_fetch_array($imageqry); $imagename=$image['attachmentName']; echo "<img src=\"foxmaincms/webroot/files/small/$imagename\"/>"; echo "</td>"; echo "<td valign=\"top\">"; echo "<table> <tr> <td valign=\"top\"> <a href=\"hotels.php?id=".$row['id']."\" class=\"titleslink\">".$row['name']."</a> </td> </tr> <tr> <td class=\"text\" valign=\"top\"> ".$row['location']." </td> </tr> </table>"; echo "</td>"; echo "</tr>"; } echo "</table>"; for hotel pagination Code: [Select] <?php include("includes/hotelsManager.php"); $hotelObj = new hotelManager(); $where = isset($_POST['where']) ? $_POST['where'] : ""; if(isset($_POST['where'])) { $hotelObj -> getHotel($where); $per_page = 9; //Calculating no of pages $sql = "select * from hotels where city_id = (select id from cities where name = '$where' ) or country_id = (select id from countries where name = '$where' )"; $result = MYSQL_QUERY($sql) or die("<br />No Hotels found in this city, please check the city name and try again"); $count = mysql_num_rows($result); $pages = ceil($count/$per_page) ?> <div id="loading" ></div> <div id="maincontent" ></div> <ul id="pagination"> thank you in advance $text = "wow {one|two|three}fsasfa happy ness"; preg_match('/\b{*+}\b/i', $text, $matches); print_r($matches); Basically, $matches will contain "one|two|three" - but all I got is an array with "}" This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=331552.0 Hello, I am creating a website with the use of php and mysql. While I am not advanced, I've been learning quite a bit on php. However, I am looking to build a tracker type script and hide it into my coding so that if someone were to hack into my website and take my website coding, that it would send me an email notifying that they were using my coding. How would I go about this? If you can help me, i'd be glad to credit you! Thank you! This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=356031.0 This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=331514.0 Hello !
How I can make a script of my PHP code to work even if my website is not running
Can I make this with php ?
if ($count==1){ header("Location:store.php"); }very simple I have issolated it and it doesn't redirect maybe u can see where my mistake is Hey guys, I always get a "1" return form php mail, but with the large number of users, 10% aren't getting the email, so they are all constantly emailing me asking me help with their contact info. The email address that im sending from is noreply@mydomain.com its the actual domain of the site. I'm using swfit mailer, but i've done this with just normal mail. When asked about spam, some customers said it went there, but most didn't, they just never got it. How can i reliably send email to my customers? Thanks! Hello,
I have problem durring binding update query. I can't find what is causing problem.
public function Update(Entry $e) { try { $query = "update entry set string = $e->string,delimiter=$e->delimiter where entryid= $e->id"; $stmt = $this->db->mysqli->prepare($query); $stmt->bind_param('ssi',$e->string,$e->delimiter,$e->id); $stmt->close(); } catch(Exception $ex) { print 'Error: ' .$ex->getMessage(); } }When I run function update I'm getting next error:Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement Can you help me to solve this problem ? Edited by danchi, 17 October 2014 - 10:25 AM. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357806.0 I am calling CURL and trying to do a POST request with parameters: Code: [Select] $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER, Array("Accept: application/json", "Content-Type: application/json")); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($curl, CURLOPT_USERAGENT, "curl 7.23.1 (x86_64-unknown-linux-gnu)"); curl_setopt($curl, CURLOPT_USERPWD, "username:password"); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_URL, "https://www.mydomain.com/route"); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, "key1=blah1&key2=blah2"); return curl_exec(curl); The problem, inside the request at http://www.mydomain.com/route I am not seeing any POST parameters passed. I.E. Code: [Select] print_r($_POST); Code: [Select] Array ( ) Should have key1=blah1 and key2=blah2. Any ideas? I've joined querys because I'm making my own forums. However, when it gets to the echoin out part, it shows the category and only ONE of the sub categorys. Code: [Select] <div id="forumContainer"> <?php $lastboard = ''; $forumQ = mysql_query("SELECT f1.cat_name as catName, f1.cat_id as catID, f2.cat_id as subCatID, f2.sub_id as subID, f2.sub_name as subName, f2.sub_desc as subDesc FROM `forum_cats` as f1 LEFT JOIN `forum_sub` as f2 ON f1.cat_id = f2.cat_id GROUP BY f2.cat_id "); while($forumF = mysql_fetch_assoc($forumQ)) { if($forumF['catName'] != $lastboard) { echo '<div class="forumCat">'.$forumF['catName'].'</div>'; $lastboard = $forumF['catName']; } echo '<div class="forumSub">'.$forumF['subName'].'</div>'; } ?> </div> |