PHP - Links??
ok so im trying to make a news website and i want to be able to include links inside me headline like most news website they talk about the stuff and include some links along the way how would i manage to do that. I would put all my story in the Release textarea
Code: [Select] <form class="createheadline" action="createrelease.php" method="post" enctype="multipart/form-data"> <table> <tr> <td></td> <td><?php echo $msg;?></td> </tr> <tr> <td>Author:</td> <td><input type="text" name="author" size="30"/></td> </tr> <tr> <td>Date:</td> <td><input type="text" name="date" /></td> </tr> <tr> <td>Title:</td> <td><input type="text" name="title" size="30"/></td> </tr> <tr> <td>Main Picture</td> <td><input type="file" name="picture" /></td> </tr> <tr> <td>Release:</td> <td><textarea name="release" cols="75" rows="27"></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="submitbtn" /></td> </tr> </table> </form> Similar Tutorials<html> <?php $id = $_GET['id']; $dbusername="web148-matt"; $dbpassword="matt"; $dbdatabase="web148-matt"; mysql_connect(localhost,$dbusername,$dbpassword); @mysql_select_db($dbdatabase) or die( "Unable to select database"); 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("SELECT * FROM count"); while($row = mysql_fetch_array($result)) { echo "<a href=" .$row['link']. ">Link</a>"; } ?> <a href='http://www.google.com'>Google</a> <a href='/index.php?id=2'>link2</a> </html> So I have been working on my website for a while which all is php&mysql based, now working on the social networking part building in similar functions like Facebook has. I encountered a difficulty with getting information back from a link. I've checked several sources how it is possible, with title 'Facebook Like URL data Extract Using jQuery PHP and Ajax' was the most popular answer, I get the scripts but all of these scripts work with html links only. My site all with php extensions and copy&paste my site links into these demos do not return anything . I checked the code and all of them using file_get_contents(), parsing through the html file so if i pass 'filename.php' it returns nothing supposing that php has not processed yet and the function gets the content of the php script with no data of course. So my question is that how it is possible to extract data from a link with php extension (on Facebook it works) or how to get php file executed for file_get_contents() to get back the html?
here is the link with code&demo iamusing: http://www.sanwebe.c...-php-and-jquery
thanks in advance.
Hi... I am really new to this. Please help me with this... as part of a gallery, I have categories and a thumbnail. As of now the title/link to the gallery shows up on the side of the thumbnail. How can I place the link below the thumbnail? Here is the code Code: [Select] $result_array[] = "<a href='viewgallery.php?cid=".$row[0]."'>".$row[1]."<img src='/photos/categoryimages/category".$row[0].".jpg' border=0 height='133px' width='200px' </a>"; Thank you for your help... I am trying to create a link with an ID from one of my MySQL records. $data = mysql_query("SELECT * FROM USERS"); $info = mysql_fetch_array($data); echo "<a href=a.php?'$info['id']'>hello</a>"; is what I am attempting, but this does not work. Any ideas? Hi, I need to get links from a web page and display them. User enters a url say abcxyz.com and all the links present on the page abcxyz.com will be displayed. How can i do this? Thanks. Hi, I have a string which contains a mix of Content and anchor links Example: //Example $strContent = 'I am some <a href="/content.htm">Content</a> here, but I could have <a href="/link.php">a Link</a> <a href="http://www.example.com">Followed by another</a> Link, Mix external and not.'; I basically want to programatically pull out all of the Anchor links, and have an array of such Array('/content.htm', '/link.php', 'http://www.example.com'); Help me please. Got a brain freeze as its Friday Afternoon Hey all, I'm currently coding a Few Blacklists for my Website, in which I want to code it so I'll have all blacklists on one page so the URL would be like: localhost/blacklist.php?user localhost/blacklist.php?staff I've got a Blacklist coded which all works well, just I've attempted using the $_GET function to change the code to the blacklist that they clicked on... <?php session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); $Username = $_SESSION['username']; ?> <table width='50%' cellpadding='0' cellspacing='0' border='1' class='table' align='center'> <tr> <td class='header' align='center' colspan='4'>Other Blacklists:</td> </tr> <tr> <td align='center'><a href='?user' target='mainFrame'>User Blacklist</a></td><td align='center'><a href='?money' target='mainFrame'>Most Money</a></td><td align='center'><a href='?racewins.php' target='mainFrame'>Race Wins</a></td><td align='center'><a href='?racelose' target='mainFrame'>Race Loses</a></td> </tr> <tr> <td align='center'><a href='?miles' target='mainFrame'>Most Miles</a></td><td align='center'><a href='?fosbl' target='mainFrame'>Faster Or Slower</a></td><td align='center'><a href='?police' target='mainFrame'>Police Chase</a></td> </tr> </table> <br /> <table width='20%' cellpadding='0' cellspacing='0' border='1' class='table' align='center'> <tr> <td colspan='2' align='center' class='header'>User Blacklist:</td> </tr> <tr> <td align='center' class='omg' width='5%'>Num:</td><td align='center' class='omg' width='10%'>Username:</td> </tr> <?php if ($_GET['user']){ $Query = mysql_query("SELECT * FROM users WHERE userlevel = '1' OR userlevel = '5' ORDER BY rep DESC LIMIT 25"); for ($Place < 25; $This = mysql_fetch_object($Query);){ $Place = $Place+1; if ($This->username != $Username){ $Colour = "bgcolor=#424242"; }else{ $Colour = "bgcolor=#111111"; } print ("<tr><td width='5%' align='center' $Colour>$Place</td><td width='20%' align='center' $Colour><a href='profile.php?viewuser=".$This->username."'>$This->username</a></td></tr>"); } } ?> </table> <br /> Soon as I added the $_GET['user]{ it stopped showing the Blacklist completely. Sorry if it wasn't explained well, but hopefully you can catch what I'm trying to-do Thanks. Hi all, Im sorry if this is in the wrong section. But nonetheless, I use php to display my news: I.e - news.php?id=1 that displays all the news on that id. What I want to know is using php how can I get the URL from news.php?id=1 too something like /news/titleofthestory ? Hope I've given enough detail. Thanks!! I have some links created dynamicaly with php. But i have the following problem. When i am in the root folder ieg. localhost/myPage/index.php the links work fine because they link in a file named entry.php. but when i am in a folder ieg. localhost/myPage/users/authors.php and i click the links they try to go to localhost/myPage/users/entry.php and i want them to link not inside the folder but to the root folder localhost/myPage/entry.php. Hi! I have an odd problem... I inserted a flash file in a php doc, and basically what happens is that on some computers, the link does not work without the www extension ... by that i mean if people go to http://mysite.com they will not be able to click the banner but if they put http://www.mysite.com it works... Very odd as the link is part of the flash movie and it only happens on some computers not all ... anyone would have an idea as to what could cause this ? Alternativly what can I do with this piece of code that does not seem to do the trick either Code: [Select] <div class="subtitulo"><a href="http://hostelsuites.com/hostel-banner.php?Buenos+Aires+Hostel+Suites+Florida&id_hostel=30&idioma=3&id_banner=2"><?php echo ucfirst($lang["expanish"]) ?></a><br /> <br/></div> Many thanks for any help ! I'm trying to make a link to an SQL database survive though page reloads, and it's not working. Connecting, I use this: function link_to_converted_database() { $link = mysqli_init(); if (!$link) { die('mysqli_init failed'); } if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 1')) { die('Setting MYSQLI_INIT_COMMAND failed'); } if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 50)) { die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed'); } if (!mysqli_real_connect($link, 'redacted', 'redacted', 'redacted')) { die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } comment( ' Success... ' . mysqli_get_host_info($link) ); if (mysqli_query($link,'USE conversion_database')) { comment("now using conversion_database."); } else { die('Conversion database unusable (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } $_SESSION['mysql_link']=$link; echo "<!--\n"; var_dump($_SESSION['mysql_link']); echo "\n-->\n"; return(true); } Subsequent SQL commands work fine using $_SESSION['mysql_link'], and the var_dump returns: object(mysqli)#2 (17) { ["affected_rows"]=> int(0) ["client_info"]=> string(48) "mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $" ["client_version"]=> int(50007) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["field_count"]=> int(0) ["host_info"]=> string(24) "192.168.1.101 via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(16) "5.1.48-community" ["server_version"]=> int(50148) ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(194) ["warning_count"]=> int(0) } After a page changes, all my $_SESSION vars work fine except for $_SESSION['mysql_link']. It's still there, but SQL queries bomb, and var_dump returns: Warning: var_dump(): Property access is not allowed yet in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Property access is not allowed yet in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 object(mysqli)#1 (17) { ["affected_rows"]=> NULL ["client_info"]=> NULL ["client_version"]=> int(50007) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> NULL ["error"]=> NULL ["field_count"]=> NULL ["host_info"]=> NULL ["info"]=> NULL ["insert_id"]=> NULL ["server_info"]=> NULL ["server_version"]=> NULL ["sqlstate"]=> NULL ["protocol_version"]=> NULL ["thread_id"]=> NULL ["warning_count"]=> NULL } There's got to be a way to save my SQL linkages so that I don't have to reconnect to the SQL database every time I want to see if new data has arrived, but this doesn't seem to be it. My PHP version is PHP 5.3.2.0. Thanks for any help. I've been reading about trackbacks and pings but what I'm trying to do is a bit different. I'm trying to track a referral link. For example, I post this referral link http://www.my-site.com/3ji89 on youtube or a blog.. and that referral links to.. http://www.another-site.com in http://www.another-site.com is it possible to retrieve the referral link http://www.my-site.com/3ji89 ? Not youtube.com or the blog I posted the link on. With my custom CMS I'm developing I have a menu structures type module where the admin can create a menu structures for their website. Inside the db is the links table and I'm trying to figure out what I can do if the link has an actual image. I created a field called link_image however I just thought of what if the link is apart of a sprite which would have most of the time 3 parts of the image (active, hover, normal) or whatever or has its own sprite. How should I handle this if I want to store this information in the database. Hi, I have a peice of code which publishes an image with a link from my database. However I cant get it to use external links. My code is: echo "<a href=\"" .$link . "\"> <img src=\"" .$image ."\" /> </a><BR />"; I have tried all the options I can think of but I cant get it work. Can anyone advise please? Hi, I've been working on making my own FAQ system for my site with PHP & MySQL, I have the SQL displaying properly on the page but I cant seem to figure out how to make it so when the page loads just the questions show and when a question is clicked the answer shows below it. I've read a number of tutorials and when I do get it to work it will only show the answer to the first question when the link is clicked. Here is the code I'm using to display the info from the database: Code: [Select] <div id="faqSQL"> <?php foreach($result as $option) { ?> <div class="faq-question"><?php echo wordwrap($option['faqquestion'], 100, "\n", false);?></div> <div class="faq-answer"><?php echo wordwrap($option['faqanswer'], 100, "\n", false);?></div> <?php } ?> </div> If anyone can help it would be much appreciated. Hello dear friends, Let say we have Code: [Select] $to = "gigi"; then we have link like this Code: [Select] mysite.com/file.php?id=$1 We can change it to new form by add rule at .htaccess codes Code: [Select] RewriteRule -(.*)\.htm file.php?id=$1 So that the link be like this Code: [Select] mysite.com/$to-$id.htm it will works , Now what if i want to make the link like this Code: [Select] mysite.com/$id/$to.htm what will be the .htaccess code in this way ??? thanks hi guys i need a bit of help, im trying to build a page which lists all orders in the database, and next to each order put in some links. i could do this fine, but i've now changed certain things and each user has certain permissions. my table is like this _users firstname | lastname | login | password | groupid _usergroups groupid | groupname _usergroup_permissions groupid | area | subarea all should be self explanitory, but in the permissions table `area` refers to the page (orders, customers, system) and `subarea` refers to the actual permission (Add, Edit, Delete, Manage) using the following script, im trying to: 1 - trying to get all the orders 2 - getting the groupid from the users table 3 - getting the permissions for the particular user's group $qry = mysql_query("SELECT o_id, sales_id, job_number, accounts_id, cust_id, status FROM `_orders` ORDER BY o_id DESC LIMIT 50") or die(mysql_error()); while ( $row = mysql_fetch_array($qry) ) { $sql1 = sprintf("SELECT `group` FROM `_users` WHERE `login` = '%s'", $_SESSION['user']); $qry1 = mysql_query($sql1); if(!$qry1){ die('could not query:' . mysql_error());} $sql2 = sprintf("SELECT `subarea` FROM `_usergroups_permissions` WHERE `gid` = '%s' AND `area` = 'Order' ", mysql_result($qry1, 0)); $qry2 = mysql_query($sql2); if(!$qry2){ die('could not query:' . mysql_error());} my group permissions are set to Add Edit and Delete, but there are additional privilages. what i want to happen is for each user that logs in, next to each order are links and depending on if they have the permission, the link will be shown. i tried using the following code in the while loop but it only showed upto the second if statement, and nothing else $link = "<a href='#'>View</a> | "; // show regardless of permissions (THIS WORKS if($racc == 0){$link .= "<a href='#'>Pick Up</a> | ";} // shown if the accounts id isn't set (THIS WORKS) if($qwerty == Edit ){ $links .="<a href='#' onclick='return false'>Edit</a> | ";} //Shown if the permission level says the user can Edit (THIS WORKS) if($qwerty == Delete ){ $links .="<a href='#' onclick='return false'>Delete</a> | ";} //Shown if the permission level says the user can Delete(DOESN'T WORK) if($qwerty == Approve ){ $links .="<a href='#' onclick='return false'>Approve</a> | ";} //Shown if the permission level says the user can Approve (DOESN'T WORKS) if($qwerty == Acceptance ){ $links .="<a href='#' onclick='return false'>Acceptance</a> | ";} //Shown if the permission level says the user can Acceptance (DOESN'T WORKS) I asked about this on another forum and they said its because $qwerty cant be everything and that i should look at using an array, unfortunately that has an undesired effect. so to summaraize...for me the page should look like order - salesman - customer - VIewLink | Addlink | Editlink | Deletelink | Approvelink but for someone who (for example) doesn't have the ADD and Delete permissions order - salesman - customer - VIewLink | Editlink | Approvelink . if NONE of that makes sence, i can provide links and try to explain again. but what i want is different links to be shown depending one what permissions a user has thanks for any help (sorry for waffling on a bit...its getting to that time of the day ) Jack I am trying to get the output for a mysql query to be displayed in colums. I have it where it does this but it goes from left to right. I would rather it go from top to bottem, it would look better this way. I will also need it to brake into sevral pages when there are a certain amout of entrys shown. If you know of a good how to on that let me know please. The other problom that I am having is to make the output a link. I was able to do this before I attemped to devide everything but if I add in what I had before it comes back with no data. Here's what I have now that put shows the data from left to right in 2 colums. Code: [Select] <?php include"scripts/connect.php" ; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM movies WHERE type LIKE 'movie' ORDER BY title"; if(mysql_query($query)) { $result=mysql_query($query); $num=mysql_numrows($result); } for($i=0; $i<$num; $i++) { if($i%2==0){ echo "<tr><td>"; } else{ echo "<td>"; } print mysql_result($result,$i,"title"); if ($i%2==0){ echo "</td>"; } else{ echo "</td>"; } } echo "</tr>"; ?> Thanks in advance Hi Everyone..
I am not sure if I should post this question here. I would like to fix this problem using PHP rather than HTML. I am new to PHP. This code is part of an old PHP gallery file. I am trying to validate my site but the site's links have some characters that makes the link throw errors in W3C Validator. So I tried to replace the characters with HTML characters for example ? are now replaced by ?
so my original link before using valid HTML characters looked like
www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-artAnd now it looks like this ... www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-artBut now W3C Validator shows an error like this Line 32, Column 240: an attribute value must be a literal unless it contains only name characters …n class='next'><a href=viewgallery.php?cname=Colorado-Journeys&pca…✉ You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary. |