PHP - How Do I Retrieve A Link From A Mysql Database So That It Behaves Like A Link In The Php Page,
Hello.
I have a bit of a problem. When I fetch the link field from the database.i don't see an actual link on the page.
One more thing, what type of field should I use to store the link in the database? Probably there is where I went wrong.
All help is
Similar TutorialsCode: [Select] <?php echo $row_Recordset1['name']; ?> i want to convert the name in to like <a href=main.php?name= $row_Recordset1['name'] >> in databse i has 3 name Steve Mark Lisa i want that names into link like main.php?name=mark and so on how to do it help me h Hi I've got this database I created with fields ProductId ProductName Image I've managed to get it to list the ID,productname, and Image urls in a list. My next step is to have the image field actually display an image and make it clickable: heres what I've done so far: Code: [Select] <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("productfeed", $con); $result = mysql_query("SELECT * FROM productfeeds"); echo "<table border='0'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Image</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; echo "<td>" . $row['ImageURL'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Heres what I want to do: Code: [Select] while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; // my changes beneath echo "<td>" . <a href="<?php echo $row['ImageURL'];?>"> <img src="<?php echo $row['LinkURL']; ?>"> </a>. "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Can you guys point me in the right direction? Many thanks Is there anyway of saving data to phpmyadmin, and linking it to another page with one button. I can do it separately but I can't seem to do it using one button. Does anyone has any ideas! Hi, Is it possible to build a PHP Template page that selects and publishes a row of data from a MySQL Database when a linked is clicked? I would design: Template.php Text links (perhaps on homepage of navigation bar): ProductA, ProductB and ProductC If you click link ProductA Template.php would display data for ProductA and likewise for ProductB and ProductC. I would also like search engines for find ProductA, ProductB and ProductC PHP pages. (Not just my single Template.php) Any ideas as to how this could be done without designing individual PHP pages for each product? Kind regards, Matthew. Hi guys.. 1st post here. I'm pretty new to php.. just a few weeks in. I've gotten pretty decent at making mysql connections and extracting data, but now I'm wanting to take one of my urls that I echo to my page and create a new page. Hoping someone can help... Here's the pictu MY MySQL Setup: I have 1 table called table1. It has 2 columns which a 'Title' & 'Description' My Index.php Page: I connect to mysql. I pull the 'Title' from MySQL and loop it to produce 100 rows of data that fill my index page, as expected. My Problem: I now want to be able to click one of those rows and dynamically create a new page (description.php) that includes the 'Title' & 'Description'. My Progress: I've managed to click a row and create a hyperlink to mysite.com/$title (where 'title' is pulling the 'title' from the mysql db) but I all I get is page not found. My Question: How do I tell description.php to pull the 'Title' and 'Description' and link to it from index.php? My Gratitude: Thanks in advance! Hi, Im trying to retrieve HTML from a mysql database but nothing i've tried seems to work. The HTML im trying to retrieve is an iframe with a link and styles (code from amazon associates). Im trying to display links to specific products on amazon from the product page on my site. All data about the product is retrieved from the database so i have code to select the amazon link row in my database table but i cant get it to display. It says the html isnt a string so i cant echo it, fair enough. I have tried using the following code: Code: [Select] $get_buylink_sql = "SELECT mobo_buylink FROM mobo WHERE mobo_id = $mobo_id"; $get_buylink_res = mysqli_query($mysqli, $get_buylink_sql) or die(mysqli_error($mysqli)); while ($buylink = mysqli_fetch_array($get_buylink_res)) { echo"<iframe src=\"".$buylink."\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"></iframe>"; } mysqli_free_result($get_buylink_res); mysqli_close($mysqli);I have also tried putting the whole iframe code in the database which didnt work either. The mobo_id variable works fine for retrieving the rest of the data and i need to get the amazon link from the same record. I hope i've put this in a way you can understand, but if not i'll try and explain better and give you a link to my site if needed. Thanks, Alex Am a newbie in php. Since I can't insert values to the database with respect to a user Id or with any other token using WHERE clause. I.e "INSERT INTO receipts(date) VALUES(example) where id="**....." If I need to fetch several values of column for a particular user, how do I go about it? Thank you!!! Hello people, I have created an application in Code Charge where my site users can login and play games online.The game code is run via flash and html. The Game has 5 stages and from a page in my application called transfertogame.php , i transfer them to the game page. Now i want to be able to track each players progress via database so that when they log back in and they get to the transfertogame.php page, it can check the page they were on before and immediately take them to the page without starting from page 1. Any help will be appreciated as i am very poor with php scripting This is the session ID i guess is being used from my application page //Initialize Method @4-537EA73F function Initialize() { if(!$this->Visible) return; $this->ds->Parameters["sesUserID"] = CCGetSession("UserID"); } //End Initialize Method //Validate Method @4-7E1FC38C function Validate() { $Validation = true; $Where = ""; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method i have 8 division (div), i want to display 4 rows in 4 division and the remain 4 rows in the next 4 division here is my code structure for carousel
<div class="nyie-outer"> second row third row
fourth row fifth row sixth row seven throw eighth row
</div><!--/.second four rows here-->
sql code
CREATE TABLE product( php code
<?php how can i echo that result in those rows
Hey guys!, Any help is greatly appreciated! what i want to do is store a link to a pdf file which will open the file when clicked. just now when clicked will only open the file name but not with the extension .pdf? Thanks! Hey, I just wondered if someone could help me with this small problem? Here's the code: <?php if($_GET['act'] == "generate_quotes") { $db = mysql_connect("*", "*", "*") or die ("Unable to connect to database."); mysql_select_db("quote") or die ("Unable to select database."); $offset_result = mysql_query( " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `quote` "); $offset_row = mysql_fetch_object( $offset_result ); $offset = $offset_row->offset; $result = mysql_query( " SELECT * FROM `quote` LIMIT $offset, 1 " ); $fetch = mysql_fetch_array($result); echo "<blockquote>".$fetch['q_quote']; mysql_close($db); } else { echo "<img src=\"1.png\">"; } ?> <a href='gen.php?act=generate_quotes'>Generate</a> Basically what it does is shows an image until a link is clicked, then the image disappears and some quotes are generated in it's place. When you click the link, sure enough, the image disappears and the quotes are read from the database. But after that the link doesn't change the quote. [it's meant to randomly cycle through the quotes in the database]. The quote still changes when refreshing the page, but this link: <a href='gen.php?act=generate_quotes'>Generate</a> does nothing after 'generate_quotes' has been set. any ideas how to fix this? thanks in advance. hi guys, im new to this forum I'm new also to php, I need help from you guys: I want to display personal information from a certain person (the data is on the mysql database) using his name as a link: example: (index.php) names 1. Bill Gates 2. Mr. nice Guy i want to click Bill Gates (output.php) Name: Bill Gates Country:xxxx Age: xx etc. How can i make this or how to learn this? Hi all, I find myself in need again on PHP coding and the support last time was outstanding (no creeping here) so I am trying my luck again! I am trying to use a HREF link (lots of individual ones) to search a Mysql database and return the results in a PHP page. Example of HREF links on the page are he https://flighteducation.co.uk/Create.html and in theory you click a career and it 'gets' and 'shows' the data from the database he https://flighteducation.co.uk/Careers.php so, you click the 'Animator' link ->it goes to my database and drags back all the data to the Careers.php page
So far this is what I have managed to not get right: HTML (screen shot added/attached Links.png)
<a href="Careers Results.php?jobTitle=Animator"> PHP
$id = $_GET['jobTitle']; if( (int)$id == $id && (int)$id > 0 ) { $link = mysqli_connect('localhost','MYUSERNAME','MYPASSWORD','MYDATABASE'); // Connect to Database if (!$link) { die('Could not connect: ' . mysqli_connect_error()); } $sql='SELECT * FROM careers WHERE jobTitle=' .$id; $result = mysqli_query($link,$sql); $row = mysqli_fetch_array($result); echo $row['jobTitle']; echo $row['jobDescription']; } else { echo "Record NOT FOUND"; } Up to now the code returns "Record NOT FOUND" so it is passing through the php to the end. I am new to PHP and trying to get my head around it all, and in theory this is the kind php code that I should be looking at, but I am still very new to it!! Any help or advice very much appreciated again!!!
Thanks
Hello all! I am somewhat new to PHP and SQL, but I think I have a basic understanding of how the language works. I have read through a million different websites and forums, and have tried a million different ways but am just not getting anywhere! This is what I am trying to do... I have a text link that I want to click through to an outside URL from my website. This outside URL was already entered into an SQL database, and I just cant seem to get the text link to bring up the outside URL from the database. This is what I have so far... 1.) My webpage that I am working on is www.mywebsite.com/articles.php 2.) I want the text "Read more..." on this webpage to click through to an outside URL, like "http://www.google.com", which was already entered into an SQL database under the title of "article_link" in a new window 3.) So I would like for "Read more..." to click through the outside URL that was entered into "article_link" in the database Code: [Select] <?php echo <p><a href="\' . $article_link . '\" target="_blank">Read more...</a></p>; ?> Nothing I have tried has worked so far, nothing clicks through to the outside URL in the "article_link" entry from the database. Sorry if I am being redundant, I have been at this all day! Please help and thank you in advance!! I have finaly got my removing recods page working, but i do have one problem... i have a delete button which goes to a new php page which contains the DELETE FROM, this deletes the record automaticaly. There are two paths which i could choose from the problem is i am stuck on both of them. 1. a link that will activate the delete code. 2. once the record has been deleted then it will automaticaly go back the the first page. can any one help me here please? <html> <?php include connect.inc; $id = $_GET['id']; mysql_query("UPDATE count SET clicks=clicks+1 WHERE id='$id'"); $sql = mysql_query("SELECT link FROM count WHERE id='$id'"); $fetch = mysql_fetch_row($sql); $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { echo "Name :{$row['id']} <br>" . "Subject : {$row['link']} <br>" . "Message : {$row['count']} <br><br>"; } mysql_close(); ?> <a href='/index.php?id=1'>link1</a> <a href='/index.php?id=2'>link2</a> </html> hello, is there a way to check a query to see if a link is in it? like if i have $description=$row['description']; and $description says something like Mikes bio is at http://www.website.com/mike/ i want to be able to click that link is this possible? Hi Support, I have a form, where it collects user description input. I can collect the inputs and store it with newline. The issue is - how to collect the http link to actual hyperlink ref during display. The following is my code: <textarea name="description" cols="50" rows="10" id="description"><?php echo str_replace("<br>", "\n", $description);?></textarea></td> For example, User input: Hi, Check it out - http://www.google.com/ I would like to display google link as href so that Viewers can click the link and go to the page. Right now, it is not href and user need to copy the link to new tabs or pages and then it can come. Thanks for your help. Regards, Ahsan Hi, So my code returns this: mysql_query() expects parameter 2 to be resource, null given My query & result is: $query = "SELECT * FROM wow_logon.accounts WHERE forum_acc = ('$userid')"; $result = mysql_query($query,$connect); So, something's wrong with my connect variable: $connect = mysql_connect($conf["host"],$conf["user"],$conf["password"]) or die(mysql_error()); mysql_select_db($conf["db"],$connect) or die(mysql_error()); So I don't get why it doesn't work, perhaps the select db isn't parsed, but it's told which database to use in the query :/ Any help is much appreciated. Im fairly new to PHP and have a quick question. I am creating a mail system from scratch and I have two main SQL rows, ID and read. I need to put a link around the ID so that it only pops up in a pop up window that message. This is the coding I have so far, feel free to point out where I have gone wrong: <? include('../config/config.php'); $Query = sprintf("SELECT * FROM qa LEFT JOIN EmployeeInfo ON(qa.Agentsname = EmployeeInfo.Name) WHERE EmployeeInfo.Name LIKE '%s'", mysql_real_escape_string($_SESSION['SESS_NAME'])); $result = mysql_query($Query); $num_rows = mysql_num_rows($result); echo "<table border='0' cellspacing='10' cellpadding='10'>"; echo "<tr>"; echo "<td><strong>Message ID</strong></td><td><strong>Team Lead</strong></td><td><strong>Unread/Read</strong></td><td><strong>Score</strong></td>"; while($row = mysql_fetch_array($result)) { echo "<tr><td><a href='http://10.0.11.5/form/employees/attendance/qaview.php?id='". $row['ID'] . ">" . $row['ID'] . "</a></td><td>" . $row['Name'] . "</td><td>" . $row['read'] . "</td><td>" . $row['Score'] . "</td></tr>"; } echo "</table>"; ?> and this is the qaview.php page <? include('../config/config.php'); $query = doquery("SELECT * FROM qa WHERE ID='$ID'"); $update_query=doquery("UPDATE qa SET read='1' WHERE ID='$ID'"); $row = mysql_fetch_array($query); echo "<td><strong>" . $row['Name'] . "</strong></td></tr>"; ?> |