kopythat
Mar 7 2005, 07:27 PM
| | I am trying to create a page on a site and I cant seem to figure it out
All it is to do is be an ad page, with an admin. to show a picture/logo with a short description of services offered, with the business name linked. I wanted an admin page for my client, who knows less than me. Then to display all info from database. Only the admin can add, or maybe submit with admin approval.
If anyone can help me out that would be greatly appreciated.......either with their own code or some code out there somewhere that i canr find
Kopy |
Reply
mobious
Mar 8 2005, 10:00 AM
i will help you make a script. please elaborate the whole client area. what data willl be included and the like. i need to know so that i can make make you a script. the script will NOT include ANY html. i will make use of a template system. you are the one who will make the design of the client area.
Reply
stevey
Mar 8 2005, 10:30 AM
for mysql i'd suggest strongly that you go get a mysql class, try phpclasses.org and look for mysql classes, its quite easier dealing with objects than it is dealing with functions. infact nowadays everything i code is all oop .. you should give it a try go check out the site..
Reply
mobious
Mar 8 2005, 11:34 AM
i'll share my class. if ever it will be used, please do not remove the heading which shows that i made it. here are the constants used. CODE define('BEGIN_TRANSACTION', 1); define('END_TRANSACTION', 2); the mysql class itself CODE /*************************************************************************** * MySQL Class * ------------------- * Created : Tuesday, Mar 11, 2003 * Copyright : (C) 2003 ENIGMA Designs - PHPBIT * Email : support@3nigma.com * * * * ***************************************************************************/
class db { var $db_connect_id; var $query_result; var $row = array(); var $rowset = array(); var $num_queries = 0; var $in_transaction = 0; function db ($server, $username, $password, $database, $persistence = false) { $this->server = $server; $this->username = $username; $this->password = $password; $this->database = $database; $this->persistence = $persistence; $this->db_connect_id = ($this->persistence) ? mysql_pconnect($server, $username, $password) : mysql_connect($server, $username, $password); if ($this->db_connect_id) { if ($database != "") { mysql_select_db($this->database); } else { return false; } return $this->db_connect_id; } else { return false; } } function close () { if ($this->db_connect_id) { if ($this->in_transaction) { mysql_query("COMMIT", $this->db_connect_id); } return mysql_close($this->db_connect_id); } else { return false; } } function query ($query = "", $transaction = false) { unset($this->query_result); if ($query != "") { $this->num_queries++; if ($transaction == BEGIN_TRANSACTION && !$this->in_transaction) { if (!mysql_query("BEGIN", $this->cb_connect_id)) { return false; } $this->in_transaction = true; } $this->query_result = mysql_query($query, $this->db_connect_id); } else { if ($transaction == END_TRANSACTION && $this->in_transaction) { $this->in_transaction = false; if (!mysql_query("COMMIT", $this->db_connect_id)) { mysql_query("ROLLBACK", $this->db_connect_id); return false; } } } if ($this->query_result) { unset($this->row[$this->query_result]); unset($this->rowset[$this->query_result]); if ($transaction == END_TRANSACTION && $this->in_transaction) { $this->in_transaction = false; if (!mysql_query("COMMIT", $this->db_connect_id)) { mysql_query("ROLLBACK", $this->db_connect_id); return false; } } return $this->query_result; } else { if ($this->in_transaction) { mysql_query("ROLLBACK", $this->db_connect_id); $this->in_transaction = false; } return false; } } function numrows ($query_id = 0) { if (!$query_id) { $query_id = $this->query_result; } return ($query_id) ? mysql_num_rows($query_id) : false; } function affectedrows () { return ($this->db_connect_id) ? mysql_affected_rows($this->db_connect_id) : false; } function numfields ($query_id = 0) { if (!$query_id) { $query_id = $this->query_result; } return ($query_id) ? mysql_num_fields($query_id) : false; } function fieldname ($query_id = 0, $offset) { if (!$query_id) { $query_id = $this->query_result; } return ($query_id) ? mysql_field_name($query_id, $offset) : false; } function fieldtype ($query_id = 0, $offset) { if (!$query_id) { $query_id = $this->query_result; } return ($query_id) ? mysql_field_type($query_id, $offset) : false; } function fetchrow ($query_id = 0) { if (!$query_id) { $query_id = $this->query_result; } if ($query_id) { $this->row[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC); return $this->row[$query_id]; } else { return false; } } function fetchrowset ($query_id = 0) { if (!$query_id) { $query_id = $this->query_result; } if ($query_id) { unset($this->rowset[$query_id]); unset($this->row[$query_id]);
while($this->rowset[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC)) { $result[] = $this->rowset[$query_id]; }
return $result; } else { return false; } } function fetchfield ($query_id = 0, $rownum = -1, $field) { if (!$query_id) { $query_id = $this->query_result; } if ($query_id) { if ($rownum > -1) { $result = mysql_result($query_id, $rownum, $field); } else { if (empty($this->row[$query_id]) && empty($this->rowset[$query_id])) { if ($this->fetchrow()) { $result = $this->row[$query_id][$field]; } else { if ($this->rowset[$query_id]) { $result = $this->rowset[$query_id][$field]; } else if ($this->row[$query_id]) { $result = $this->row[$query_id][$field]; } } } } return $result; } else { return false; } } function rowseek ($query_id = 0, $rownum) { if (!$query_id) { $query_id = $this->query_result; } return ($query_id) ? mysql_data_seek($query_id, $rownum) : false; } function nextid () { return ($this->db_connect_id) ? mysql_insert_id($this->db_connect_id) : false; } function freeresult ($query_id = 0) { if (!$query_id) { $query_id = $this->query_result; } if ($query_id) { unset($this->row[$query_id]); unset($this->rowset[$query_id]); mysql_free_result($query_id); return true; } else { return false; } } function error () { $result['message'] = mysql_error($this->db_connect_id); $result['code'] = mysql_errno($this->db_connect_id); return $result; } }
Reply
kopythat
Mar 8 2005, 07:34 PM
basically this is the layout to have a picture or logo <BR> Business name (linked to website or mailto) <BR> Brief description about services offered. <BR><HR> then the list goes on....... if it could be creatde so there is a "page of liinks" so on my template i can <? include ("filename.php") ?> As for the admin, just a simple form (no templating required) that he can enter in the data of the new link Business name: " " http/mailto " " Description " " Upload "Browse" then all the info will be extracted onto this "filename.php" page and will be called when included in my template "links.php" Thanks Kopythat
Reply
Mike
Mar 8 2005, 09:22 PM
Hmm.. I could probably do one but mine would include HTML... [CODE]SQL CREATE TABLE `businesses` ( `id` int(10) NOT NULL auto_increment, `business` varchar(255) NOT NULL default '', `description` text NOT NULL default '', `emailaddress` varchar(255) NOT NULL default '', PRIMARY KEY(`id`) ) TYPE=MyISAM; PHP/HTML <html> <head> <title>Businesses</title> </head> <body> <center> <table border=".01" align="center"> <tr bgcolor="#D0D0D0"> <td><b>ID</b></td> <td><b>Business</b></td> </tr> <?php $query=mysql_query("SELECT id,business FROM businesses ORDER BY id ASC"); while($row=mysql_fetch_row($query)) echo '<tr bgcolor="#E0E0E0"><td><a href="http://YOURSITELINK.com/show_business.php?business='.$row[0].'">'.$row[0].'</a></td><td>'.$row[1].'</td></tr></table>'; ?> </body> </html> --SAVE AS businesses.php-- PHP/HTML FOR show_business.php <?php $business = $_GET['business']; ?> <html> <head> <title>Show Business</title> </head> <body> <table border=".01"> <tr bgcolor="#D0D0D0"> <td><B>Business</b></td> <td><b>Description</b></td> <td><b>E-Mail Address</b></td> </tr> <?php $query=mysql_query("SELECT business,description,emailaddress FROM businesses WHERE id='$business'"); while($row=mysql_fetch_row($query)) echo '<tr bgcolor="#E0E0E0"><td>'.$row[0].'</td><td>'.$row[1].'</td><td><a href="mailto:'.$row[2].'">'.$row[2].'</a></td></tr></table>'; ?> </body> </html> --SAVE AS show_business.php-- --PHP FOR new_business.php-- <html> <head> <title>New Business</title> </head> <body> <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <table border=".01" align="center"> <tr> <td><B>Business Name:</b></td> <td><input type="text" name="business_name" /></td> </tr> <tr> <td><b>Business Description:</b></td> <td><textarea name="business_desc" rows="15" cols="20"></textarea></td> </tr> <tr> <td><b>E-Mail Address:</b></td> <td><input type="text" name="business_email" /></td> </tr> <tr> <td><input type="submit" name="add" value="Add!" /></td> <td><input type="reset" value="Reset" /></td> </tr> </table> </form> <?php if(isset($_POST['add'])) { mysql_query("INSERT INTO businesses SET business='{$_POST['business_name']}',description='{$_POST['business_desc']}',emailaddress='{$_POST['business_email']}'") or die(mysql_error()); echo '<tr bgcolor="red"><td><b>Business added.</b></td></tr>'; } else { echo ''; } ?> </body> </html> --SAVE AS new_business.php--
Reply
kopythat
Mar 9 2005, 06:59 AM
Thanks for the code Mike.....it works well I have made a few changes as per formating, it does everything that i want it to do Now I need to add a picture or logo upload (mysql and php portion) but the image must be less than 400 pixels wide and 200 pixels in hieght and added to the new_business.php form........If you could help me out with that it would be greatly appreciated. Here are the modifications I have made to the code MYSQLCREATE TABLE `businesses` ( `id` int(10) NOT NULL auto_increment, `business` varchar(255) NOT NULL default '', `description` text NOT NULL default '', `emailaddress` varchar(255) NOT NULL default '', `website` varchar(255) NOT NULL default '', PRIMARY KEY(`id`) ) TYPE=MyISAM; new_business.php (added website) <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <table border=".01" align="center"> <tr> <td><B>Business Name:</b></td> <td><input type="text" name="business_name" /></td> </tr> <tr> <td><b>Business Description:</b></td> <td><textarea name="business_desc" rows="15" cols="20"></textarea></td> </tr> <tr> <td><b>E-Mail Address:</b></td> <td><input type="text" name="business_email" /></td> </tr> <tr> <td><B>Website:</b></td> <td><input name="business_website" type="text" /></td> </tr> <tr> <td><input type="submit" name="add" value="Add!" /></td> <td><input type="reset" value="Reset" /></td> </tr> </table> </form> <?php if(isset($_POST['add'])) { mysql_query("INSERT INTO businesses SET business='{$_POST['business_name']}',description='{$_POST['business_desc']}',emailaddress='{$_POST['business_email']}',website='{$_POST['business_website']}'") or die(mysql_error()); echo '<tr bgcolor="red"><td><b>Business added.</b></td></tr>'; } else { echo ''; } ?> </body> </html> show_business.php (changed table and text formating and showed all businesses on same page) <?php $query=mysql_query("SELECT business,description,emailaddress, website FROM businesses "); while($row=mysql_fetch_row($query)) echo '<table width="495"><tr><TD><div align="center"><strong>'.$row[0].'</strong></div><BR></td></TR><TR><td><div align="center">'.$row[1].'</div></td></TR><TR><td><div align="center"><a href="mailto:'.$row[2].'">'.$row[2].'</a><BR></div></td></TR><TR><TD><div align="center"><a href="http://'.$row[3].'">'.$row[3].'</div></td></tr></table><HR width="400">'; ?> business.php (no changes) Didnt need Thanks again in advance Kopythat
Reply
Similar Topics
Keywords : mysql, php, script
- How To Make Php Newsletter Script
(3)
Php Guest Online Script
(3) make an index.php copy and paste this code CODE <?php $db_host = "localhost";
$db_user = "root"; $db_pass = ""; $db_name = "test";
$dbc = mysql_connect($db_host, $db_user, $db_pass); $dbs =
mysql_select_db($db_name); $tm = time(); $timeout = $tm -
(30*60);
if($_SERVER["REMOTE_ADDR"]){$ip=$_SERVER["REMOTE_ADDR
"];} else{$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];}....
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.....
Guessing Php Script
(2) I am looking for: freeware php quess the person in the photo game script....
Create Table - Mysql Code - Help
(1) I need your feedback about setting the database issues. Please, review them and correct some entries
in the code if they got some mistakes. This is the code itself: SQL CREATE TABLE
`news` ( `id` int(250) NOT NULL auto_increment, `title` varchar(255)
NOT NULL default '', `text` text NOT NULL, `author` varchar(255) NOT
NULL default '', `valid` varchar(255) NOT NULL default '',
`date` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE = ....
Mysql Error
(3) ok i need some more help from the wonderful coders here at Trap. I'm almost done with my CMS
script, but i'm having a problem with the installer.php file, when it trys to inseret the user
data into the database i keep getting the following error: CODE mySQL Error: You have an
error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near ';INSERT INTO `members` (`id`, `name`,
`username`, `password`, `email`, `title`) ' at lin....
Html Form!
Using MySQL?! (4) Hey, I need your help again! I need some good working tutorial how I can update my SQL through
HTML form. I did use some tutorials online found with the help of google; but they do not work
properly; I mean there are still small mistakes. I need to have a good tutorial to follow. It
should be based on security and more things. It has to be done in proper way.......
Best Php And Mysql Editor For Noobs
anyone any php or mysql editor that is good for noob (6) hi there guys, from my previous posting, i am a noob in php and mysql programming. I want to know
if there are any php and mysql editors which are best for me as a noob. i appreciate your kindness
....
Php And Mysql Programming
anyone knows a code for mysql and php (2) hi everyone! I am making a program using php and mysql...I am a noob on this so i need your
help guys...I want to make a simple program that will some values and then store them on a database
and then retrieve them...uhmm let me give an example out put of what i need. This is the example
say..: Enter First Name: Enter Last Name:
Enter Age: Enter Address: ..those
are the data needed for input values...my question now is how can I make a database....
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.....
How Do I Connect To Live Database With Php Script?
while being hosted with ComputingHost (6) I am not new to programming. I want to create a form to add some values into my tables, the code
are all working. But I am not sure what is the URL to connect to my site's database. All along,
I have been testing through MAMP, which provides a local copy of mySQL. Can anyone lend me a hand?
My site's URL is http://limetouch.com/ ....
Best Sites For Learning Php-mysql
(4) Hi I was reminded of this earlier by a post in a topic, meant to post it but forgot and the topic on
php books reminded me. Well anyway there is tyhschools for learning php (unless someone else knows
a better 1) but I wan't to know what is the best site for using php with mysql (using
phpmyadmin) also whats the difference between postgresql and mysql? though I must admit the
postgresql version of phpmyadmin whatever it's called looks better (visually)!....
Tools Needed!
PHP & MySQL (9) Hello, everyone! I need some tools for those two things to test PHP scripts coming together with
database on my laptop, instead checking them on a web-server which takes time.....
Download Script For Mp3 Files
(0) Hello, I'm looking for a download script for sound files (e.g. mp3, avi, wma, and other ones).
i have found a few download scripts but they would not work for sound files for some reason. also
this will not be used for allowing downloading of illegal or riped music, what i will be using this
script for is i'm making a site for my church and the pastor wants to be able to recored the
services and then have me upload them to the site so that the church members can download them for
what ever reason. If some one could tell me how to make one or could show me a plac....
Php Rediret Script
(12) Ok, what I am trying to do is this. Re-direct a domain name called: avalon.asn.au to
preschool.stmarksavalon.org.au I have created a script that will re-direct within the a folder.
However, the avalon.asn.au and stmarksavalon.org.au are PARKED Domains. Any ideas on how to create
this PHP Redirect Script please?....
Library Script
Where? (6) Hello, everyone. Anyone knows where I can get a library script that acts like CMS script software,
you can add books or delete them. I want to build virtual online library which can be accessible to
everyone. Or just give me some advices how to make it build. I'm a novice in programming.....
Script Help Required: Undefined Variable
A fault I cannot spot in PHP (3) Hi, when running a PHP script I keep getting the error: QUOTE Notice: Undefined variable: bret
in c:\program files\easyphp1-8\home\poll.php on line 294 Notice: Undefined
variable: bret in c:\program files\easyphp1-8\home\poll.php on line 294 (And,
yes, I get it twice). The code related to the variable is as follows: CODE function
LogString($string,$type) { $t_log = "\n";
$t_log .=
$this->globaldata->server_vars['REMOTE_ADDR']."....
Php Downloads Script
(4) I've been looking all over the net for a PHP script which can provide an interface to browse a
downloads database. The database could be powered by MySQL. If you know a script like this, please
post it here. Thanks in advance, Ironchicken.....
Mysql Won't Update
(4) Ok, so I'm making some arcade administration software so I don't have to add games the hard
way, well anyway, one of the features I have is that on the homepage is a featured author and as
such I just have it so it updates one line in the mySQL. Well, the page with the form passes on the
varibles fine and the updating page recieves them because I echoed everything, then I build the
query and I even echo the query and it comes out exactly how I want it to, but for some reason, the
database itself won't update even though all the varibles are there. Here's....
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....
Creatting A Playlist Through Php
script help needed (5) Hi I am trying to make a script so that i can insert songs into a playlist, but i need a script in
which it opens the playlist file and removes the closing tag at the end, so before i can add more
entrys. e.g CODE <atx> <entry>Location 5</entry> <entry>Location
4</entry> <entry>Location 3</entry> <entry>Location
2</entry> <entry>Location 1</entry> <atx> But to add more entrys
i would have to get rid of the atx, then use the fputs to place the new entry into the file. ....
What Kind Of Script Do You Need ?
post here and get free script (15) Hi everybody sorry if i posting here , i know I want design free PHP script and i dont know
webmasters what kind of scripts want i think its better to aks here becuase trap17 is very nice
webmasters forum So , Plz post here what kind of script with details you need ! sorry may en
is not very well for example you need "upload center" : write "upload center" with upload center
options ( like Ajax , Fast , multi lan and ... ) with this post we can give script details and
webmasters idea /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.....
Free Auction Script
Any Suggestions? (6) Any free auction script suggested? I want it to be as many practical functions as possible, yet
easy to manage. And more importantly, it is free! Appreciate your kind suggestions!....
Watermark Your Image With Simple Php Script
found it on the net (35) 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 // ....
Creating Profiles In Php/mysql ?
(7) i've started to learn php..im familiar to basics of php and mysql now.Now for example i want
that some user can register to my website , and after that he can Login and log out , and he can see
his profile.is there any tutorial about this ? or any helping url .. or any helping answer please
/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....
Subquery In Mysql
(5) Is there anyway to make subqueries work in MySQL? I'm pretty certain someone out there knows
how. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> Can anyone help?
CODE Select * from ITEMS where ID="Select Max(ID) from ORDERS"; This works
for MSAccess and SQL Server but why not in MySQL? I'll be writing some reports and I've
shifted database from MSAccess to MySQL. Help! Thanks.....
Can You Add Images Into A Mysql Database?
Using Php? (20) I'm learning php in class right now, but I'm still not that good at it, what I'm
wondering is when I write the php so that it can connect with a database, can I at the same time
have it that it is able to display back images that I choose. Like, I want a search feature, where
you can search for a keyword, and it will bring back a list of all the possible entries with that
keyword, but each of these entries will have a photo associated with it. Now, do I put these image
files directly into the database, or do I write the code to link them from my files to th....
Parse: Error Unexpected T_lnumber
php parse error when running script (4) Hi. I've just created a php script. The main object of the script is to delete some old files
and replace it with a new file with some new content, effectively moving the contents from one file
to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) {
$a_B++; } $new_page_contents = " " . $_POST . " " . $_POST . "
include \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen(&....
Increment A Mysql Column
how to increment a MySQL column one unit (7) Hi, I have a column in a MySQL table which contains a counter of the views of the object described
by this table. I would like to increment this value by one everytime the object is viewed. Obviously
came into my mind the possibility of retrieving the value of this field, store it in a variable
increment this value by one and perform an UPDATE query again with this new value. My question is if
there is a MySQL option to update the field with its actual value plus an unit increment. I hope you
understand the issue.....
Script: Php Jukebox
A one file script! (4) This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder
called 'songs' and put some audio files in it. Here is the whole page, I named it index.php
and put it in a folder called 'music': CODE <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
<title>PHP jukebox</title> </head> <body> <!-- ©2005 Craig
lloyd. All rights reserved. Visit cragllo.com for more sc....
Looking for mysql, php, script
|
|
Searching Video's for mysql, php, script
|
advertisement
|
|