Jul 26, 2008

Urgent: Need Script Made...

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming
Pages: 1, 2

free web hosting

Urgent: Need Script Made...

cragllo
I need a sort of simple content managment script...

So, I need a mySQL database with the following fields:

Field : example of use

ID : 1
Name : Orange Distster
Description : The best
Image : http://sponk......file.png
Location : http://sponk......file.zip

And I need to be able to display this in a tabel
CODE
<table border="1" cellpadding="0" cellspacing="0">
               <tr>
                 <td align="center" valign="top">
<img src="(IMAGE)">
                 </td>
                 <td width="397" align="left" valign="top">
<font size="2" face="Arial"><strong>(NEME)</strong><br>
(DESCRIPTION)<br>
<a href="(LOCATION)">DOWNLOAD</a></font>
                 </td>
               </tr>
</table>

And will display these in order, newest to olders, 5,4,3,2,1...


That sort of thing, you get me? if someone could do this for me, I would be that happiers person in the world...

Thank you,
Craig.

 

 

 


Reply

FaLgoR
<?
$query = mysql_query("SELECT * FROM table ORDER BY id DESC");
?>
<table border="1" cellpadding="0" cellspacing="0">
<?
while($var = mysql_fetch_array($query)){
?>
<tr>
<td align="center" valign="top">
<img src="<?=$var[image]?>">
</td>
<td width="397" align="left" valign="top">
<font size="2" face="Arial"><strong><?=$var[name]?></strong><br>
<?=$var[description]?><br>
<a href="<?=$var[location]?>">DOWNLOAD</a></font>
</td>
</tr>
<?
}
?>
</table>


Try to do it, if its not in the order u want, try to change "DESC" for "ASC".

smile.gif

 

 

 


Reply

cragllo
ok, im kind of new to mySQL, how does it connect to the database? and what fields do I need to put in?


Also, how can I sho how many times it has been downloaded or how many times the link has been clicked?

Reply

FaLgoR
Connecting to database:
$dbhost = 'localhost';
$dbuser = 'user';
$dbpass = 'password';
$dbname = 'name';

mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);

You will have to add the fields name, image, description... just like we have used above.

Note: I have user vars to define the database info, but its not needed.

If you have any other question, post again and I'll try to help you :)

Reply

cragllo
Ive put it all in and it works fine, other things i wish to know is,

How to dhow how many times the file had been downloaded or the dwnload link clicked... and hoe to display 10 per page...

Reply

FaLgoR
OK, put this code on your page:

<?
$query = mysql_query("SELECT * FROM table ORDER BY id DESC");
?>
<table border="1" cellpadding="0" cellspacing="0">
<?
while($var = mysql_fetch_array($query)){
?>
<tr>
<td align="center" valign="top">
<img src="<?=$var[image]?>">
</td>
<td width="397" align="left" valign="top">
<font size="2" face="Arial"><strong><?=$var[name]?></strong><br>
<?=$var[description]?><br>
<a href="download.php?id=<?=$var[id]?>">DOWNLOAD</a></font>
</td>
</tr>
<?
}
?>
</table>

And now, lets do download.php:

<?
if(!$id)
return;

$query = mysql_query("SELECT * FROM table WHERE id=$id;");
$download = mysql_fetch_array($query);

if(!file_exists($download[location])){
print "Download file not found.";
exit;
}

mysql_query("UPDATE table SET clicks=(clicks+1) WHERE id=$id;");

header("Location: $download[location]");
?>

Don't forget to connect with database and add the column "id" to your database (with auto_increment). If it doesn't work, please post again and i'll look for the problem.

Reply

cragllo
When I click the link to download it shows the error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/cragllo/public_html/download.php on line 15
File not found.


Also Ive added two more fields:
Preview: for large image preview
creator: to show the author

Does that make a difference?

Also I need a page with a form to add new data...

Reply

FaLgoR
QUOTE(cragllo @ Jan 6 2005, 06:03 PM)
When I click the link to download it shows the error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/cragllo/public_html/download.php on line 15
File not found.
Also Ive added two more fields:
Preview: for large image preview
creator: to show the author

Does that make a difference?

Also I need a page with a form to add new data...
*



Are you sure you have conected to the database on download.php?

Reply

cragllo
My mistake, I fogot to change:

$query = mysql_query("SELECT * FROM templates WHERE id=$id;");


How can I make a form to ad records to the database?



You can see what im doing here: http://sponkindustries.co.uk/templatesfree2.php

Reply

FaLgoR
let's make insert.php (or something else):

<?
if($go){ // if var $go is set
mysql_query("INSERT INTO table(name,description,image,location) VALUES ('$name','$desc','$image','$location') or die (mysql_error());
print "Done!";
exit;
} else { // not really required at this case but...
?>

<form action="insert.php" method="post">
Name: <input type="text" name="name"><br>
Description: <input type="text" name="desc"><br>
Image: <input type="text" name="image"><br>
Location: <input type="text" name="location"><br>
<input type="submit" name="go" value="Submit">
</form>
<?
}
?>

But don't forget to connect this page with the database. I suggest that you make a new page called conection.php with all the details and connections, and put: include("conection.php"); at the top of the pages which requires an connection.

Reply

Latest Entries

cragllo
I use this script on my site hosted at Trap17 wothoit any problems, my other site is hosted elsewhere, and global vars it turned off for security reasopn, and nothing seems to work...

Reply

Deaths Aprentice
QUOTE(FaLgoR @ Jan 7 2005, 09:06 PM)
let's make insert.php (or something else):

<?php
if($go){ // if var $go is set
mysql_query("INSERT INTO table(name,description,image,location) VALUES ('$name','$desc','$image','$location') or die (mysql_error());
echo "Done!";
exit;
} else { // not really required at this case but...
?>

<form action="insert.php" method="post">
Name: <input type="text" name="name"><br>
Description: <input type="text" name="desc"><br>
Image: <input type="text" name="image"><br>
Location: <input type="text" name="location"><br>
<input type="submit" name="go" value="Submit">
</form>
<?php
}
?>

But don't forget to connect this page with the database. I suggest that you make a new page called conection.php with all the details and connections, and put: include("conection.php"); at the top of the pages which requires an connection.
*



My changes are in bold, some of them are not really needed, but this way it's better wink.gif

EDIT: Heh, sorry, thought there was only 1 page ^.^, didn't see the other replys.

PS Have you been trying out with this script, is MySQL down because of this xD?

Reply

bjrn
You can do it without the global vars turned on, just instead of having $id in the code you use $_GET['id'].

If you think it's too bulky just have
$id = $_GET['id'];
somewhere at the top of your code.

Reply

cragllo
Thank you FaLgoR, I may be moving all my sites onto one server soon, to save time and hastle, and so global vars will be turned on then.... Not sure yet tho, may cost too much...

If and when I do, Ill tell you (If you havent already found a solution that is)


Craig.

Reply

FaLgoR
QUOTE(cragllo @ Jan 23 2005, 11:04 AM)
the download page is not working on my sims website...

global vars is turned off, does that effect the download page?

here it is, download.php
CODE
<?
$dbhost = 'localhost';
$dbuser = ''; // removed for this
$dbpass = ''; // removed for this
$dbname = 'toxicsims';

mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
?>
<?
if(!$id)
return;

$query = mysql_query("SELECT * FROM objects WHERE id=$id;");
$download = mysql_fetch_array($query);

if(!file_exists($download[location])){
print "File not found.";
exit;
}

mysql_query("UPDATE templates SET clicks=(clicks+1) WHERE id=$id;");

header("Location: $download[location]");
?>


Would anything need to be added, I had some help off my bros m8 to do the insert page. he added the $_POST bits in for me...
*



well man, I think the globals have to be turned on because the page sent an url: download.php?id=1, so, if the globals are turned off it doesn't work. I'll try to found an solution for your problem, and I'll send u another msg if I find it.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Similar Topics

Keywords : urgent, script, made

  1. Php Guest Online Script
    (2)
  2. I Need Help With Setting Up My Site, Made Using Java
    any help would be appreciated (5)
    I just got web hosting approved and I want to host the site I created using Struts framework.
    I'm a complete newb when it comes to web hosting, so I need a little help. Is there a tutorial
    that covers this subject? I apologize in advance if this question was already answered, but
    I've been unable to find the answer anywhere. One thing I have to note is that I need to know
    absolute address of the uploaded files in order for my application to work. Is this even allowed?
    Any help with hosting of Java applications will be appreciated.....
  3. Invisionfree Skin How-to Put On Your Forum
    A skin I partially made, I show you how to put on your forum. (0)
    Hey All who may want an invisionfree forum skin, because they are tired of their old, boring,
    squarish one. Well I helped with this skin, and I'm going to give an explanation for starting
    users, so that they may too, have a nice forum skin! First of all, when installing a new skin on
    your board, no upload or download is needed. You will most definately have to replace your old forum
    CSS or "Style sheets" (as called in the invisionfree Admin CP). You will almost all the time have
    to place something in the footer (in Board wrappers IN THE ADMIN CP), and usually a ....
  4. Phpizabi Social Network Script
    (1)
    Hello everyone not been on for AGES! we had net problems and i had to move to qupis and now
    I've got problems. I'm making a social networking site using this script and I cant get it
    to install Everytime I go to the install page i get this QUOTE Warning: session_start() :
    open_basedir restriction in effect. File(/home/kasiks1/tmp) is not within the allowed path(s):
    (/home/karlos:/usr/lib/php:/usr/local/lib/php:/tmp) in
    /home/karlos/public_html/phpazi/install/index.php on line 1 Fatal error: session_start() : Failed
    to initialize storage module: file....
  5. How To Make A View New Post Script?
    (5)
    Ok so i'm still working on the forum software i posted about a while back, but I have no idea
    how to do this. I want to make a view new post script, as this is one of the main things that my
    forum software dose not have that all other forums have. so does any body have an idea on how i
    would do this? Thanks.....
  6. Recommended List Of Money Making Sites
    A list of 10 sites from which easy money can be made (0)
    I just want to let everyone know I have updated my list of money making websites and in my opinion
    the 10 listed are the most reliable and honest money making sites that are free to join available.
    Please review this blog and let me know what you think http://makeeasymoney247.blogspot.com ....
  7. I Made $25 In 15 Minutes
    (7)
    I actually made $25 in about 15 minutes. Mostly just by entering my email into forms supplied
    by the website. Its cool because they deposit your money directly into your Pay Pal account. Check
    it out by copying and pasting the link below. http://www.treasuretrooper.com/ Referral
    links are not allowed at Trap17. Removed. ....
  8. Guessing Php Script
    (0)
    I am looking for: freeware php quess the person in the photo game script....
  9. Cant Login To Cpanel On A Just Made Account O_o
    (2)
    yes,i cant login i can login to normal panel but not to cpanel i get an error every time i login i
    created a ticket some days ago and im not getting a responce please help me ThePro....
  10. Webmail Server Script
    (2)
    Hi Guys! A friend of mine came to me asking me to help him write code for his server so that
    his clients can go on his site and create a webmail account. I told him I'm not a programmer but
    I googled the subject. I ran into SquirrelMail and was impressed with what it could do. Going
    through the documentation I saw this QUOTE There are only two requirements for SquirrelMail:
    A web server with PHP installed. PHP needs to be at least 4.1.0. Access to an IMAP server which
    supports IMAP 4 rev 1. I have php5 running on my XPproSP3 but I don't know....
  11. My 2 Best Sigs I've Ever Made
    (3)
    Here you go, I worked really hard on these to make them right /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> In my opinion they are my 2
    best Sorry about same font, I couldn't find a better one LOL....
  12. Sig Pop Rate Please
    I made it a while back (2)
    This is one of my inferior sigs. I'm currently not on my computer but when I am I will post my
    other sigs that I have but rage this one though /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" /> I decided to go crazy with filters XD....
  13. I Just Made This Sig Rate It Plz
    (13)
    ....
  14. A Survey About Our Country/gov't
    Something I made up (2)
    I made this survey that asks some questions about your feelings of our country and our government at
    this current time. This isn't for anything particular, just for my own interest. Answer in any
    kind of format you feel like. 1. What are your current feelings about how our government is
    handling our country? (not Iraq) Couldn't be worse 1 2 3 4 5 6
    7 8 9 10 They are geniuses 2. What do you think we should do about Iraq?
    A. Get out immediatly B. Stay the course C. Drasticly rethink our pla....
  15. Mysql-essential-5.0.51 Installion Problem
    please help me.(urgent) (2)
    Dear friend, please help me. Iam working on php project (matchmaking site). I have downloaded mysql
    essensial 5.0.51. When i was installing mysql 5.0.51, i got following error - Error 1901: Error
    attempting to read from the source installation database:
    c:\windows\installer\527ec6.msi What is solution of this problem ? Iam using
    windows xp professional version 2002 (service pack 2). Please post your reply. Iam waiting for your
    answer. ....
  16. Need Help Installing Dolphin Community Script!
    (5)
    I'm not sure if this is the right place to post this but I really need help in installing the
    dolphin community script. I have absolutely no previous experience of scripts or programming. I
    would really appreciate if someone could walk me through it step-by-step, or even do it for me by
    logging into my cpanel. I have tried to install it my self but I'm a little confused. I'm
    sure it won't take very long at all for someone who has done this before.....
  17. What If Marijuana Was Legal?
    What would happen? Should it be made legal? (27)
    Recently I did a school report on Marijuana, in my paper I'm supporting the fact that Marijuana
    should be made legal. I thought "some" people would like to read my work, and maybe talk about it
    some. Please, tell me what you think! /wink.gif" style="vertical-align:middle" emoid=";)"
    border="0" alt="wink.gif" /> Also, sorry if there's some typos and misspellings. For I am
    really tired, and this isn't fully done yet. Also, you should know I spend some time comparing
    weed to tobacco, that's all I'll say =) QUOTE Marijuana 1 ou....
  18. What Made You Switch To Linux?
    (32)
    I first tried Linux a few years ago, not because I was completely against Windows or anything like
    that, but just because I had some free time on my hands. I started off with Mandrake 9.0 which was
    very user friendly and Windows-like. After reading through a bunch of message boards and learning
    which distros are good for what, I soon realized my current distro was great for Linux noobs. So
    then I decided to try something a little more advanced like Slackware which I knew had a steep
    learning curve. Since then I've been using Slackware as my main OS and couldn't ....
  19. Loaing Script
    (3)
    hello, I'm looking for a preloader script for my site. like it will display an loading
    image while the site is loading and the once the page has loaded the image will disapear. i tryed
    searching for one on google but i could not find one, i think i searched for the worng thing. if
    some one knows how to make one or where i can find one that would be great. Thanks....
  20. Invite Script..
    (2)
    I didn't know where else to put it /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" /> If moderators find another forum more suitable plz move this one
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> I am looking
    for some sort of sript or program that let's people on your website invite friends. Like they
    put in their Emailadress and mails are send to everyone in their list.. I hope someone can help me
    /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Greetzz....
  21. Background Image Swap Script
    Change a Background Image based on clock time (15)
    Background Image Changer Script To swap the background image from your CSS file according to the
    Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {
        background: url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the
    folder, place three images named morning.png, day.png, night.png. 4.) Also, in the same folder,
    create an index.php file and copy/paste the following script. CODE <?php $hour =
    date('H'); if ($hour < 12 ) {     $image =
    "morning.png"; } ....
  22. Html Code Tester. Online Script
    (15)
    Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
    this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
    Current script: CODE <?php //Save this as something like htmltest.php function
    CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
    input $html_safe=str_replace("<?php"," ",$html_unsafe);
    //Starts security measures $html_safe=str_replace("?>","
    ",$html_sa....
  23. Free Myspace Script?!?
    I didn't know that was possible . . . . (3)
    I was looking for scripts to put on my website one day, and it turned up this!
    http://www.phpizabi.net/ It's a free open-source script, and it has most of the qualities of
    myspace.com! And best of all, you can mend it the way you want! I might use it, but on one
    of my subdomains . . . . My friend already tried it out, he said it works fine! His website is
    under construction right now, but I'll give you the link to it when he's done . . .....
  24. Watermark Your Image With Simple Php Script
    found it on the net (34)
    This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
    Scripts site. Just in case the site may not show, I will include the code here: List of things
    needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
    script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
    image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
    transparent gif image with the watermark - goes in the same directory as this script // ....
  25. Maximum Adsense Per Day!
    The max. cash you've made in a day? (45)
    I'm only a few months old in the Adsense family. I'd really like to know the maximum amount
    you've made from adsense in one day. Just on the lookout for the pros in this joint. Well as for
    me (this is embarrassing!) I have made $3.71 in a single day from three clicks and
    that's a miracle considering my average daily earnings which of couse tends to zero! So
    guys.. tell me about your adventures with Adsense.....
  26. Setting Aflame A Sinner's Hope
    A song i made for my band Lord of the Sabbath (3)
    Setting Aflame To A Sinner’s Hope Burn! If you thought for a moment I was just like you Then
    you’re sadly mistaken This world goes by like a déjà vu But I’m never a part of them If you’ve seen
    what I have, then you know I’m right This world will crumble in its own perversions Raging fire is
    louder than their screams Only matter of time before everything’s gone Gone Gone Burn! If you
    thought your rejections would make me cry Sorry to say that you’ll never break me You were never
    able to make up your mind It’s pretty sad watching someone about to die I got t....
  27. Free Weather Feed Script
    (1)
    If you are tired of providing your clients with weather feeds that take visitors off of their site
    or slam their site with ads, I finally found one after searching for hours. Here's a link to a
    FREE php script that pulls the feed directly from any airport in the world to your site. It is easy
    to customize and has simple, well documented installation instructions.
    http://www.mattsscripts.co.uk/mweather.htm hope you find it helpful... a good one for designers
    to archive as you will most likely need it some day for a client. Check out Matt's other free
    scripts....
  28. Php Quiz Script
    Make quizzes for your site. (20)
    Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
    doesnt do anything special but I am going to make an email mod for it so that it will email results
    to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
    editor and paste in the following code. CODE <?php $qid = "Quiz ID-00"; ?>
    <html> <head> <title><? echo "Gamers Pub $qid";
    ?></title> </head> <body> <p><h3><? echo "....
  29. Java Script Drop Down Menu With Css
    - a full code for a dynamic drop down (2)
    Introduction This is a code that I use to dynamically create the drop down menus. First, you have
    to edit the following code and put it in your Javascript. Notice : /*** SET BUTTON'S FOLDER HERE
    ***/. Edit that to your folder. Also, the /*** SET BUTTONS' FILENAMES HERE ***/. This creates a
    mouseover when the drop down is activated. Put all your onmouseover images under: oversources = new
    array; and your onmouseout images under : upsources. Be sure to set your on and out images above
    each other. CODE /*** SET BUTTON'S FOLDER HERE ***/ var buttonFold....
  30. Could Someone Make A Php Script For Me?
    Script to manage clans and players (3)
    Does someone know a script where you can 1. Add clans to a roster 2. Edit clans on a roster 3. Add
    players too a clan 4. Edit players 5. Schedule matches 6. Add clan Leaders to manage their own clan
    + members 7. Add members to edit their own information And maybe some sort of scoreboard integrated
    where you can put Wins, Draws and loses and that automaticly puts best clans on the top? If there
    isnt such a script could someone create 1 for me? (its for a league ^^)....

    1. Looking for urgent, script, made

Searching Video's for urgent, script, made
Similar
Php Guest
Online
Script
I Need Help
With Setting
Up My Site,
Made Using
Java - any
help would
be
appreciated
Invisionfree
Skin How-to
Put On Your
Forum - A
skin I
partially
made, I show
you how to
put on your
forum.
Phpizabi
Social
Network
Script
How To Make
A View New
Post Script?
Recommended
List Of
Money Making
Sites - A
list of 10
sites from
which easy
money can be
made
I Made
$25 In
15 Minutes
Guessing Php
Script
Cant Login
To Cpanel On
A Just Made
Account O_o
Webmail
Server
Script
My 2 Best
Sigs
I've
Ever Made
Sig Pop Rate
Please - I
made it a
while back
I Just Made
This Sig
Rate It Plz
A Survey
About Our
Country/gov&
#39;t -
Something I
made up
Mysql-essent
ial-5.0.51
Installion
Problem -
please help
me.(urgent)
Need Help
Installing
Dolphin
Community
Script!
What If
Marijuana
Was Legal? -
What would
happen?
Should it be
made legal?
What Made
You Switch
To Linux?
Loaing
Script
Invite
Script..
Background
Image Swap
Script -
Change a
Background
Image based
on clock
time
Html Code
Tester.
Online
Script
Free Myspace
Script?!
? - I
didn't
know that
was possible
. . . .
Watermark
Your Image
With Simple
Php Script -
found it on
the net
Maximum
Adsense Per
Day! -
The max.
cash
you've
made in a
day?
Setting
Aflame A
Sinner's
Hope - A
song i made
for my band
Lord of the
Sabbath
Free Weather
Feed Script
Php Quiz
Script -
Make quizzes
for your
site.
Java Script
Drop Down
Menu With
Css - - a
full code
for a
dynamic drop
down
Could
Someone Make
A Php Script
For Me? -
Script to
manage clans
and players
advertisement



Urgent: Need Script Made...



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE