PHP - Having Problem With $_get
Hello again
here is my code but its dont work correct Code: [Select] $super = $_GET['video_id']; $filmai = $TSUE['TSUE_Database']->query("SELECT rasta_cinema.video_id, rasta_cinema.name, rasta_cinema.description, rasta_cinema.video_name, rasta_cinema.thumb_image FROM rasta_cinema WHERE video_id = $super LIMIT 1"); error im get is Code: [Select] Database Error! Please try again later or contact an Administrator. (1064) 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 'LIMIT 1' at line 1 SELECT rasta_cinema.video_id, rasta_cinema.name, rasta_cinema.description, rasta_cinema.video_name, rasta_cinema.thumb_image FROM rasta_cinema WHERE video_id = LIMIT 1 Thanks Similar TutorialsFirst of All hello to all I have done registration login script and when I starting to making the users profiles, I have problem in the $_GET function well this is the code <?php $getid = $_GET['id']; if (!$getid) $getid = "1"; require('scripts/connect.php'); $query = mysql_query("SELECT * FROM users WHERE id='$getid'"); mysql_real_escape_string; $numrows = mysql_num_rows($query); if ($numrows == 1){ $row = mysql_fetch_assoc($query); $id = $row['id']; $firstname = $row['first_name']; $lastname = $row['last_name']; $user = $row['username']; $avatar = $row['avatar']; $city = $row['city']; echo "<div id='profile'> <div id='leftside'> <a href='profile.php?$user'><img src='avatars/$avatar' width='100px' height='100px' border='0'</a></img><br /><a href='profile.php?$user'>$firstname $lastname <br />($user)<br /></a>$city <br /></div>"; } else echo " You have to contact administrator"; ?> When I login as user id 1 then it display all right but when I go and login as another user it display the first users piture, name, surname & city can someone tell me what the problem is ? I know is this if (!$getid) $getid = "1"; but why is this happen If someone tell me or point to the right direction I would be thank full I am having problems with my $_GET. When a user chooses an Article from "article_index.php", they click on a hyperlink, e.g. Code: [Select] <a href="<?php echo BASE_URL; ?>articles/postage-meters-can-save-you-money"> This triggers my Mod_Rewrite... Code: [Select] RewriteEngine on #PRETTY: articles/postage-meters-can-save-you-money #UGLY: article.php?slug=postage-meters-can-save-you-money RewriteRule articles/([a-zA-Z0-9_-]+)$ article.php?slug=$1 Which should take them to "article.php?slug=postage-meters-can-save-you-money" and then this code is supposed to grab the "slug" and retrieve the Article... Code: [Select] // Attempt to Retrieve Article. if (isset($_GET['slug'])){ // Slug found in URL. // Set Slug. $slug = $_GET['slug']; That part is working fine, however, if I go into the Address Bar and delete out the slug, so my URL looks like this... Code: [Select] www.MySite.com/articles/"> I would expect the ELSE part of the above code to kick in... Code: [Select] }else{ // Slug not found in URL. header("Location: " . BASE_URL . "index.php"); }//End of ATTEMPT TO RETRIEVE ARTICLE Unfortunately I am just getting this error... Quote Not Found The requested URL /articles/ was not found on this server. Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2 Server at local.debbie Port 80 Why is my ELSE not detecting that there is no slug?? Debbie I am trying to do isset($_GET but I have a bizarre problem come up. I am using "id" as one of my fields but when I try to use it in the code it says it is not recognised. However I use this field quite widely. The code its coming up with is "Undefined variable: id" but I cant see why it has a problem with id. My code is: <?php if(isset($_GET['id'])){ $sql = mysql_query("SELECT * FROM productfeed WHERE id='$id' LIMIT 1"); } { while($row = mysql_fetch_array($sql)) $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; echo "<div class=\"productdisplayshell\"> <div class=\"productdisplayoutline\"> <div class=\"productborder\"><center> <a href=\"$link\" target=\"_blank\" ><img src=\"$image\" /></a> </center> </div></div> <div class=\"productdescriptionoutline\"><div class=\"productdescriptionbox\"> <a href=\"$link\" target=\"_blank\" >$description</a> </div><div class=\"productfulldescriptionbox\"> $fulldescription </div></div> <div class=\"productpriceoutline\"> <div class=\"productpricebox\"><center>&#163; $price</center></div> <div class=\"productbuybutton\"><center><a href=\"$link\" target=\"_blank\" ><img src=/images/buybutton.png /></a></center></div></div></div>"; } ?> A few months ago, and a good amount of time before that, I had people telling me to use isset() instead of performing to see if the variable is empty, such as: !$_GET[''] I know the differences in the function and what they do, but when could isset() be used in a situation where it's better/more efficient then: !$_GET[''] I do use isset(), though. I cannot seem to get my link to work.. I want to build a php script that has more than one $_GET command.. The link I want to make is: index.php?section=tutorial&viewing=18-classes_or_ids. Here is my PHP code.. <?php $section = $_GET['section']; switch ($section) { case "home": include("home.html"); break; case "register": include("register.html"); break; case "tutorial_home": include("tutorial.html"); break; default: include("home.html"); } $tutorial = "?section=" . urlencode('tutorial&viewing') . $_GET['tutorial&viewing']; switch ($tutorial) { case "18-classes_or_ids": include("classesorids.html"); break; } ?> Please help me!! I have javascript to load to my div the contents from php files something like this: QueryString is an addon javascript file loaded above so it works.. var get_id = $.QueryString["id"]; switch(get_id){ case 'page1': $('#div').load('php.php'); break; } on php.php when i try to get the $_GET['id']; which is obviously 'page1' it cant display it... i get nothing , i use switch in order to create dynamic div so i can click in my links and just load the divs content thanks. hi all
new to webforum and php, how can I enter $_get['id] as I know this id...my code snippet is below
$sql = "SELECT x,y,z from tablename WHERE Id='" . $_GET["id"] . "'";
It works fine as it is getting the variable from a another webpage, but I know an id and want to enter it manually just to check a different webpage , thanks in advance....singhy
Please give example if the known id=xyztest
Hi I am trying to use 2 codes to get a url link. code1 (test.php): <form action="test1.php" method="GET" /> link: <input type="text" name="link" /><br /> <input type="submit" value="Submit" /> </form> code2 (test1.php) <?php $link = $_GET['link']; echo $link; ?> If I input a link as a text such as "Yahoo" it works. But if I input a link as "http://yahoo.com", it didn't work . I am seen people have dynamic pages that loads the information from a database and then displays that information from the url. EG domain.com/somedirectory/something I have a website that does this but uses domain.com/something.php?id=something . This works great but when I go to try and get the statistics for that page from facebook for number of people that have liked that page. When I go to: http://graph.facebook.com/http://likebook.cz.cc/ It shows me the information: Code: [Select] { "id": "**************", "name": "LikeBook", "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs178.ash2/41817_130259343675613_3465_s.jpg", "link": "http://www.facebook.com/pages/LikeBook/130259343675613", "category": "Website", "description": "Collect every like at LikeBook.cz.cc", "fan_count": 3 } But when I try and go to: http://graph.facebook.com/http://likebook.cz.cc/like.php?id=31 It shows me: Code: [Select] { "id": "http://likebook.cz.cc/like.php" } So what I need to do is. Make a dynamic page within that sub directory. So that http://likebook.cz.cc/like/31 does grabs the information from line 31 of my database, like http://likebook.cz.cc/like.php?id=31 would do. Thank you ~AJ I am a new programmer. I am working on a personal project for my portfolio, it is a simple blog. I am trying to give the user the ability to delete a blog entry. It works fine, the problem is that when you refresh the page, with out clicking 'delete' the entry is still deleted. $_GET is passing the $id to my function and it is executing. The code I have posted is my effort to fix the problem. How can I connect $_GET to the delete button ? I have tried using a hidden value but this is not working. Any help would be greatly appreciated. AL Code: [Select] // code to display message before deletion if($_GET['T']) { echo("<div style='float:right; width:25%; height:100px; position:absolute; top:150px; right:15%;'>"); echo("<h2>Are you sure you want to delete:<h2>"); echo $_GET['T']; echo("<form method='get' action='?'>"); echo("<input type='submit' name='button' value='Delete'>"); echo("<input type='hidden' name='submit_check' value='1'>"); echo("</form>"); echo("<form action='http://nuke.industry.com/Blogspiracy/UserPage/index.php'>"); echo("<input type='submit' value='Cancel'/>"); echo("</form>"); echo("</div>"); } // code to delete a selected blog entry function delete_blog($id) { global $dbh; $sql = "DELETE FROM tblBlog WHERE tblBlog.id = '$id' LIMIT 1;"; $sth = $dbh->prepare($sql); $sth-> execute(); return; } if (isset($_GET['id']) && ($_GET['submit_check'])) how do I "GET" the hidden value? { $remove = delete_blog($_GET['id']); } [code] I am really confused about how people use $_GET to give a page a link so far what I understand is that $_GET grabs the information from a link So if my link was http://localhost/stargate/users/profile.php?goauld=Sam how do I turn this into viewing Sams profile soon as i type in that link with out having to hit a search button first would really appreciate if someone help me understand this please cause it appears i really need to know how to do this. Code: [Select] <?php if(isset($_POST['search'])) { // searches goaulds then displays them $search3 = "SELECT goauld,id FROM users WHERE goauld='".mysql_real_escape_string($_POST['goaulds'])."'"; $search2 = mysql_query($search3) or die(mysql_error()); WHILE($search1 = mysql_fetch_array($search2)){ $grab_goauld = $search1['goauld']; echo '<table width="300" height="5" border="1" align="center">'; echo '<th><center>Goauld Statistics</center></th>'; echo "<tr><td height='340'>$grab_goauld</td></tr>"; } } echo '</table>'; ?> Hi there, I am new to this forum want to say Hi to everyone . I just learn a little bit of PHP. I couldn't figure this out. Could someone please help me? Many thanks. 1. when I ran the 1st code below, it showed me "thank you" in the browser. <?php $title=$_GET[title]; echo $title; ?> 2. when I ran the 2nd code below, I got what I wanted. <?php $sql = "SELECT * FROM mytable WHERE title='thank you' "; ... ?> 3. when I ran the 3rd code below, it showed me a blank page . <?php $title=$_GET[title]; $sql = "SELECT * FROM mytable WHERE title='<?php echo $title; ?>' "; ... ?> How to make the 3rd code work like the 2nd one? It seems a php code under php is NOT working. how would i get this to work if they have click on the add page and the action is add i want it to do something how would i do it Code: [Select] <?php if(isset($_GET['action'])){ } ?> <a href="pages.php?action=add">Add Page</a> I never really thought about it before, but recently I visited a site with a url like: www.example.com/?OR Which made me wonder how you would go about getting that keyname since it is without a value. Any ideas? Please i will like to know what this variable $_GET['id']is used for and how to use it Thanks how do i get the id from the url so i can use it Hello can any one help me with this question iv only just started to use the get function like <code> if (isset($_GET['pageID'])){ echo $row['content']; } </code> can any one if me info how to make it safe I have some javascript for a tabbed interface in index.php. The content of each tab is in content.php which uses $_GET to define which tab is selected. But i want to include queries based on variables from index.php how would i do this? here is the code for the tabbed interface: <script language="JavaScript" type="text/javascript" src="<?php echo SITE_ROOT; ?>/js/ahahLib.js"></script> <script language="JavaScript" type="text/javascript"> function makeactive(tab) { document.getElementById("tab1").className = ""; document.getElementById("tab2").className = ""; document.getElementById("tab3").className = ""; document.getElementById("tab"+tab).className = "active"; callAHAH('includes/content.php?content= '+tab, 'content', 'Loading...', 'Error'); } </script> <ul id="tabmenu" > <li onclick="makeactive(1)"> <a class="" id="tab1">Account Information</a> </li> <li onclick="makeactive(2)"> <a class="" id="tab2">Second Page</a> </li> <li onclick="makeactive(3)"> <a class="" id="tab3">Third Page</a> </li> </ul> <div id="content"></div> and the code in content.php if ($_GET['content'] == 1) { echo 'Content for Page 1'; } if ($_GET['content'] == 2) { echo 'Content for Page 2'; } if ($_GET['content'] == 3) { echo 'Content For Page 3'; } ive tried adding the variable $user_id to the content.php url as follows: callAHAH('includes/content.php?user=$user_id&content= '+tab, 'content', 'Loading...', 'Error'); } but that just brought up an error. How to find the name value using php or $_GET here is the url header("Location:http://localhost:8666/OnlineBookingsPhp/index.php?name=Next"); Thanks I have a link (http://site.com/user/redirect). This link directs me to "site.com/user.php?level=site.com/123.php?hp=1" How can I echo just "site.com/123.php?hp=1"? I know how to use $_GET but I don't know how I can apply it to this. |