PHP - Moved: How Do I Turn A Variable Into A Hyperlink?
This topic has been moved to PHP Applications.
http://www.phpfreaks.com/forums/index.php?topic=347224.0 Similar TutorialsHello Everyone, I have a quick question for you all, I think its fairly simple... I have created a database and I am using PHP to grab the data: $usera = $_SESSION['username']; $query2 = "SELECT * FROM tracker WHERE id = '$usera', hidden = yes"; mysql_query($query2) or die('Error, query failed : ' . mysql_error()); This hopefully will return multiple rows which look like this in the database. id username date reps hidden 1 supremebeing 2011-01-02 30 yes 4 supremebeing 2011-04-02 46 yes How would i turn each result into a variable eg: $date1 = 2011-01-02; $date2 = 2011-04-02; $reps1 = 30; $reps2 = 46; I think i have explained that well enough for you to understand, please reply if not though and i will provide more information. Thanks in Advance Hello How do I fetch a current visitors ip address, and turn it into a variable? The visitor should only be able to enter the same form once, so I want to compare the current visitor ip address with ip addresses in the database to achieve this. Best regards Morris This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320284.0 This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=320065.0 Hello im wondering how i can make a hyperlinks adress be a set after a variable. this is my php: $result1 = mysql_query("SELECT id, namn, url FROM stuff ORDER BY id desc limit 1;"); $result2 = mysql_query("SELECT id, namn, url FROM stuff ORDER BY id desc limit 1,1;"); <html> <a href="???"> <p class="note-general"> The first link </p> <a href="???"> <p class="note-general"> The the second link </p> </html> The important thing is that the url from $result1 will link under "the first link" and url from $result2 link under "the second link". The $_SESSION['record_to_chage'] variable is set- I know this as I can echo it out. $openedfile = file("myfile.txt"); sort($openedfile); // foreach($openedfile as $key => $newpick) { echo "<a href=\"/editpage.php?request=$_SESSION['record_to_chgange']&newcat=$newpick\" target=\"_parent\">$newpick</a>"; echo "<br>"; } The Resulting error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in For the life of me I can not figure where I am going wrong. Going to get coffee and some fresh eyes. Cheers Can someone tell me why this gives me undefined variables? The $id variable is showing up fine in this bit of code. When I click the link it is supposed to pull the data from the database related to the $id. Code: [Select] <a href='javascript: window.document.Vids<?php echo $id; ?>.submit();'>Watch</a> <form name="Vids<?php echo $id; ?>" action="<?php echo $PHP_SELF; ?>" method="post"> <input value="<?php echo $id; ?>" type="hidden" name="Vids" /> </form> here is the code which is supposed to display the info. Code: [Select] if (isset($_POST['Vids'])) { $result = mysqli_query($link, "SELECT * FROM vidaud where id =".$_POST['Vids']); echo $id; the error i get is Quote Notice: Undefined variable: id in /services5/webpages/util/b/b/bbctech2.site.aplus.net/public/dbsite/a_newsite/sermons.php on line 32 I'm just not sure why the $id variable isn't being posted by my form and read by the code. Thanks. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=327718.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=314136.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=326455.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=353775.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=312460.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=308673.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=357370.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=359149.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=343073.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=346932.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=342459.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314334.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=346503.0 |