943,735 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 850
  • PHP RSS
Nov 17th, 2008
0

Can anybody help me in writing this very simple script

Expand Post »
Hello,
I want to create my own script like www.anonym.to but with few additional features i want to use database, i believe its very easy to make but the problem i don't know php, i can write in visual basic and c++ but not php,
What do i want?? to make explaining easier i wrote a program in visual basic exactly i like i want it, download it from here, it will tell u everything
http://netmasterz.net/anonymizer.rar


I don't want the link to redirect automatically i want to store the links in database. So please if you can either create this script for me or guide me in the following:
  1. How to write in the database
  2. how to read from database
  3. when using the url http://domain.com/link=66 how can i read line 66 from the database??
  4. how to hyperlink a text by the link in the database??
but please i have very simple background on php, if anyone can create this for me i will be really thankful and you can ask whatever code or program u want in visual basic from me in case u want

I'm waiting to here from anyone,
regards and thanx in advance
Last edited by mr-cracker; Nov 17th, 2008 at 3:37 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mr-cracker is offline Offline
8 posts
since Nov 2008
Nov 18th, 2008
0

Re: Can anybody help me in writing this very simple script

If you are new to php, perhaps some simple documentation will explain the basics of php. For mysql, check out http://www.tizag.com/mysqlTutorial/ and on the left side of the page are links to tutorials of each part of using mysql. Also you can get advanced documentation from http://www.php.net And if you are wondering what program to use, a text editor like notepad will do the job and just save the files with the php extension. The documentation should answer at least half those questions.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Nov 18th, 2008
0

Re: Can anybody help me in writing this very simple script

Ok, i will try to write it if i stop anywhere i will ask in this thread

thanx for the links my friend
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mr-cracker is offline Offline
8 posts
since Nov 2008
Nov 21st, 2008
0

Re: Can anybody help me in writing this very simple script

Hi there, ok writing on database is very easy, but i don't know the following:--
1- When storing the links in the database, i want to get new link like this, domain.com/?link=89
where 89 represent row number where the link is stored??
2- when surfing the link, how can i read row 89 from the database and hyper a link with that link,

Please any reply, it will be really appreciated
regards
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mr-cracker is offline Offline
8 posts
since Nov 2008
Nov 22nd, 2008
0

Re: Can anybody help me in writing this very simple script

Click to Expand / Collapse  Quote originally posted by mr-cracker ...
Hi there, ok writing on database is very easy, but i don't know the following:--
1- When storing the links in the database, i want to get new link like this, domain.com/?link=89
where 89 represent row number where the link is stored??
2- when surfing the link, how can i read row 89 from the database and hyper a link with that link,

Please any reply, it will be really appreciated
regards
Although I don't directly know how to go straight to line 89, I do know that you could use a while loop then break the loop at line 89 then perform the actions with the fetched data. So try the following code to fetch each field of row 89 as an array.
php Syntax (Toggle Plain Text)
  1. <?
  2. $result=mysql_query("SELECT * FROM `table`") or die(mysql_error());
  3. $rownum=0;
  4. while ($row=mysql_fetch_array($result))
  5. {
  6. $rownum+=1;
  7. if ($rownum==89) //change 89 to row number to retrieve
  8. {
  9. break;
  10. }
  11. }
  12. //now if you have a column named field1 and want to display
  13. //its value on line 89 use the following
  14. echo $row['field1'];
  15. ?>
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Nov 25th, 2008
0

Re: Can anybody help me in writing this very simple script

Click to Expand / Collapse  Quote originally posted by mr-cracker ...
Hi there, ok writing on database is very easy, but i don't know the following:--
1- When storing the links in the database, i want to get new link like this, domain.com/?link=89
where 89 represent row number where the link is stored??
2- when surfing the link, how can i read row 89 from the database and hyper a link with that link,

Please any reply, it will be really appreciated
regards
If I may offer my suggestion. I think there may be a better way to go about the DB selection. If you create a column in your DB titled `ID`. I think this would be better than just reading a line number, this way if you change or remove a line in the database, it wont mess up your links.

Here is the PHP code I'd use.

PHP Syntax (Toggle Plain Text)
  1. <?
  2. $result=mysql_query("SELECT * FROM `table` WHERE ID=$_GET['link']")
  3. or die(mysql_error());
  4. while ($row=mysql_fetch_array($result))
  5. {
  6. $link = "<a href=\"".$row['link']."\">".$row['link']."</a>";
  7.  
  8. //If you create a column named `link_name` you could uncomment
  9. //the next line and comment the above line
  10.  
  11. //$link = "<a href=\"".$row['link']."\">".$row['link_name']."</a>";
  12. }
  13. //now if you have a column named link and want to display
  14. //its value as a link, use the following
  15.  
  16. echo $link;
  17. ?>
This could echo something like... (First Example)
<a href="http://www.daniweb.com/forums/forum17.html">http://www.daniweb.com/forums/forum17.html</a>
Or something like... (Second Example)
<a href="http://www.daniweb.com/forums/forum17.html">DaniWeb PHP Forum</a>

Hope this was of some help.
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
PomonaGrange is offline Offline
67 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: http request problem
Next Thread in PHP Forum Timeline: Name and Password login





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC