[PHP] php $query help
Here is my problem I have created a user login system (flash+php+mysql) And it just about works Here's the prob when i go to register as a new user the code wont properly check to see if the username already exsist's in the DB, I am pretty sure the problem lies in my first $query PHP: -- $query = "SELECT name FROM contacts WHERE name='$name'"; if ($name == $name) { print "loginT=UserName in Use"; }else{ $query = "INSERT INTO contacts (name, pass, email, id) VALUES ('$name', '$pass', '$email', NULL);"; } $result = mysql_query($query); // Gets the number of rows affected by the query as a check. $numR = mysql_affected_rows($Connect); if ($numR == 0) { // Sends output to flash print "loginT=Error - Register Again"; } else if ($numR == 1) { // Sends output to flash print "loginT=Success&checklog=1"; } -- If i take out PHP: -- $query = "SELECT name FROM contacts WHERE name='$name'"; if ($name == $name) { print "loginT=UserName in Use"; -- THe login system works fine but dupilcate entries can be submitted to the database. Please help i would love to get this up and running Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] time stamp screwing up
hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date & time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db("$dbName"); // Preforms the SQL query to see if user name already exsists $query = "SELECT name FROM contacts WHERE name='$name'"; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print "loginT=UserName in Use&checklog=2"; }else{ $query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time')"; } It inserts -00-00 instead of the current date ideas P.S I am a newbie try keeping reponse's simple please -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
nope it still comes up with all the zero's :( "Stephan Seidt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > What sort of mysql field type did you use for dateAdded ? > You need UNIX_TIMESTAMP (or sth like that) for unix timestamp format. > > - [ Paul Ferrie ] - wrote: > > hey guys could someone help me > > I have created a user login register system in flash with PHP and Mysql. > > Everthing Now works fine aprt from the time stamp of when the user > > registered. > > > > Code --- > > // Get current date & time > > $time = time(); > > // Connects to the Database. > > $Connect = mysql_connect($dbServer, $dbUser, $dbPass); > > mysql_select_db("$dbName"); > > // Preforms the SQL query to see if user name already exsists > > $query = "SELECT name FROM contacts WHERE name='$name'"; > > $rs_contacts = mysql_query($query) or die(mysql_error()); > > $row = mysql_fetch_assoc($rs_contacts); > > if ($row[name] == $name) { > > print "loginT=UserName in Use&checklog=2"; > > }else{ > > $query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES > > (NULL, '$name', '$pass', '$email', '$time')"; > > } > > > > > > It inserts -00-00 > > instead of the current date > > > > ideas > > > > P.S > > I am a newbie try keeping reponse's simple please > > > > > > > > > -- > When ipv6 and tcpa are there.. When this Palladium server wrecks.. > I won't be able to drink my coffe then! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
So Jason what your saying is this $query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES > (NULL, '$name', '$pass', '$email', '$time')"; Should be $query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES > (NULL, '$name', '$pass', '$email', NOW())"; ?? cheers "Jason Wong" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tuesday 07 January 2003 00:19, - \[ Paul Ferrie \] - wrote: > > hey guys could someone help me > > I have created a user login register system in flash with PHP and Mysql. > > Everthing Now works fine aprt from the time stamp of when the user > > registered. > > > > Code --- > > // Get current date & time > > $time = time(); > > // Connects to the Database. > > $Connect = mysql_connect($dbServer, $dbUser, $dbPass); > > mysql_select_db("$dbName"); > > // Preforms the SQL query to see if user name already exsists > > $query = "SELECT name FROM contacts WHERE name='$name'"; > > $rs_contacts = mysql_query($query) or die(mysql_error()); > > $row = mysql_fetch_assoc($rs_contacts); > > if ($row[name] == $name) { > > print "loginT=UserName in Use&checklog=2"; > > }else{ > > $query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES > > (NULL, '$name', '$pass', '$email', '$time')"; > > } > > > > > > It inserts -00-00 > > instead of the current date > > What column type is dateAdded? If it's a mysql DATE type then you should > > replace: > > '$time' > > with > > NOW() > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > It's more than magnificent -- it's mediocre. > -- Sam Goldwyn > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
So Is NOW() a mysql function? "Stephan Seidt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > yep i guess that, so NOW() is a mysql function. > > - [ Paul Ferrie ] - wrote: > > So Jason what your saying is this > > > > $query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES > > > >>(NULL, '$name', '$pass', '$email', '$time')"; > > > > Should be > > > > $query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES > > > >>(NULL, '$name', '$pass', '$email', NOW())"; > > > > > > ?? > > cheers > > > > > > "Jason Wong" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > >>On Tuesday 07 January 2003 00:19, - \[ Paul Ferrie \] - wrote: > >> > >>>hey guys could someone help me > >>>I have created a user login register system in flash with PHP and > > > > Mysql. > > > >>>Everthing Now works fine aprt from the time stamp of when the user > >>>registered. > >>> > >>>Code --- > >>>// Get current date & time > >>>$time = time(); > >>>// Connects to the Database. > >>>$Connect = mysql_connect($dbServer, $dbUser, $dbPass); > >>>mysql_select_db("$dbName"); > >>>// Preforms the SQL query to see if user name already exsists > >>>$query = "SELECT name FROM contacts WHERE name='$name'"; > >>>$rs_contacts = mysql_query($query) or die(mysql_error()); > >>>$row = mysql_fetch_assoc($rs_contacts); > >>>if ($row[name] == $name) { > >>>print "loginT=UserName in Use&checklog=2"; > >>>}else{ > >>>$query = "INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES > >>>(NULL, '$name', '$pass', '$email', '$time')"; > >>>} > >>> > >>> > >>>It inserts -00-00 > >>>instead of the current date > >> > >>What column type is dateAdded? If it's a mysql DATE type then you should > >> > >>replace: > >> > >> '$time' > >> > >>with > >> > >> NOW() > >> > >>-- > >>Jason Wong -> Gremlins Associates -> www.gremlins.biz > >>Open Source Software Systems Integrators > >>* Web Design & Hosting * Internet & Intranet Applications Development * > >> > >>/* > >>It's more than magnificent -- it's mediocre. > >>-- Sam Goldwyn > >>*/ > >> > > > > > > > > > > > -- > When ipv6 and tcpa are there.. When this Palladium server wrecks.. > I won't be able to drink my coffe then! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
Well i am still getting all the zero's : ( : ( "- Edwin" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > "- [ Paul Ferrie ] -" <[EMAIL PROTECTED]> wrote: > > So > > > > Is NOW() a mysql function? > > Well, you can check for yourself ;) > > It should be somewhere around here: > > http://www.mysql.com/doc/en/Date_and_time_functions.html > > - E > > ...[snip]... > > __ > Do You Yahoo!? > Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strange problem (user poll)
Can anyone see a problem in this? When i run the script i am getting this error "Notice: Undefined variable: action in C:\www\Apache2\htdocs\user_poll\2\addpoll.php on line 13" Could not insert poll\n"; } else { print "Poll added\n"; } mysql_close($link); } ?> please anyone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strange problem (user poll)
Sorry guys ingore the post, i have narrowed the problem down to a problem with posting the vairables from flash. cheers "- -" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Can anyone see a problem in this? When i run the script i am getting this > error "Notice: Undefined variable: action in > C:\www\Apache2\htdocs\user_poll\2\addpoll.php on line 13" > > // addpoll.php > // Case Study 1: User Poll - Foundation PHP for Flash > > // If the form has been submitted... > (line 13) if ($action == "add") { > // Include config file > include('common.php'); > > // Connect to database > $link = dbConnect(); > > // Get date for new poll > $posted = time(); > > // Build query to insert new poll > $query = "INSERT INTO polls (question, option1, option2, option3, > posted) > VALUES('$question', '$option1', '$option2', '$option3', > $posted)"; > > // Execute query > $result = @mysql_query($query); > > // If query failed... > if (!$result) { > // Display error > print "Could not insert poll\n"; > } else { > print "Poll added\n"; > } > > mysql_close($link); > } > ?> > please anyone > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $query help :(
Hi again guys i have run into another problem :( i am trying to build a user poll (flash+php+mysql) I have the interface all sorted but i have a problem with my add new poll php file. When i hit the update poll button in flash it seem that everthing has work and it' send back a msg saying all went well :). but when i check with phpmyadmin i see that the $query has been successfully added but the "question","opt1","opt2","opt3" fields are blank no data added. the only fields to be added were the auto_id and date stamp below is a sample code of the php file and after that you will see the code on the button. [php] if ($action == "add") { // Include config file include('common.php'); // Connect to database $link = dbConnect(); // Get date for new poll $posted = time(); // Build query to insert new poll $query = "INSERT INTO polls (question, option1, option2, option3, posted) VALUES ('$quest1', '$opt1', '$opt2', '$opt3', $posted)"; // Execute query $result = @mysql_query($query); // If query failed... if (!$result) { // Display error print "&result=Could not insert poll"; } else { print "&result=poll created"; } mysql_close($link); } ?> [/php] on the button in Flash i have [code] on (release) { if (!quest1.length) { result = "fields missing"; } if (!opt1.length) { result = "fields missing"; } if (!opt2.length) { result = "fields misasing"; } if (!opt3.length) { result = "fields missing"; } else { loadVariables("addpoll.php", this, "POST"); gotoAndPlay(2); } } [/code] I have tried everything i can think of but i cab't seem to get it working. Can anyone see anything i am missing? Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strange problem (user poll)
It seem there is some probs with the latest release of php something about global vars. Jst checked and it works now. It was the php thing right enough. i hope that my server admin have done the same thing with the php.ini cheers guys. "- -" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Can anyone see a problem in this? When i run the script i am getting this > error "Notice: Undefined variable: action in > C:\www\Apache2\htdocs\user_poll\2\addpoll.php on line 13" > > // addpoll.php > // Case Study 1: User Poll - Foundation PHP for Flash > > // If the form has been submitted... > (line 13) if ($action == "add") { > // Include config file > include('common.php'); > > // Connect to database > $link = dbConnect(); > > // Get date for new poll > $posted = time(); > > // Build query to insert new poll > $query = "INSERT INTO polls (question, option1, option2, option3, > posted) > VALUES('$question', '$option1', '$option2', '$option3', > $posted)"; > > // Execute query > $result = @mysql_query($query); > > // If query failed... > if (!$result) { > // Display error > print "Could not insert poll\n"; > } else { > print "Poll added\n"; > } > > mysql_close($link); > } > ?> > please anyone > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] flash and php (using the varibles)
Hi guys i hope there is someone in here that use flsah along with php to help with this :) Anyway i will make it simple. mysql returns a number say 123 i want flash to take this number to animate a progress bar, but here the problem it does work but the progress bar dosn't animate it just sets to the hieght of the numbers sent back from mysql. How can i slow down the animation of the progress bar Anyone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple query help
Hi guys, I am working on a flash forum for my site. Came with the FOED book, anyways i am tyring to delete the threadCount by -1 from the db. could below does dlete the count but in multipules of 2. Anyone cheers $query = "UPDATE forumForums SET threadCount = threadCount -1 WHERE forumID = $forumID"; if(!mysql_query($query)) { fail("Error deleting thread Count"); } $result = @mysql_query($query); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what can i store in the DB
Hi guys, I am not really an expert in this I just learn what I need to know when I need to know it. I am building a flash tutorials section for my site http://www.innovativedesigns.org.uk The section is my first real attempt at using php+mysql without having to check the books or reference files :) Anyway here is my question: Can images be stored in the DB I am thinking no. This would me a long way round what I am trying to do. cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what can i store in the DB
cheers m8 Just what i was looking for :) Thanx again "Awlad Hussain" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul > check the tutorial on Storing Images in Database > http://codewalkers.com/tutorials/35/2.html > > good luck.. BTW cool flash work :) > > > ----- Original Message - > From: "- [ Paul Ferrie ] -" <[EMAIL PROTECTED]> > To: "Awlad Hussain" <[EMAIL PROTECTED]> > Sent: Wednesday, June 11, 2003 12:05 PM > Subject: Re: [PHP] what can i store in the DB > > > > I did use www.mysql.com Search query"storing images, store image, image > > storing" it didnt come back with very much, so the post on "php" was my > > last resort. > > > > thanx for the quick reply > > > > Paul > > > > - Original Message - > > From: "Awlad Hussain" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]>; "- [ Paul Ferrie ] -" > > <[EMAIL PROTECTED]> > > Sent: Wednesday, June 11, 2003 11:56 AM > > Subject: Re: [PHP] what can i store in the DB > > > > > > > You can store image as BLOB in DB > > > I would recomend you download mysql manual from www.mysql.com, very > useful > > > > > > awlad > > > - Original Message - > > > From: "- [ Paul Ferrie ] -" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Wednesday, June 11, 2003 11:46 AM > > > Subject: [PHP] what can i store in the DB > > > > > > > > > > Hi guys, > > > > > > > > I am not really an expert in this I just learn what I need to know > when > > I > > > > need to know it. > > > > > > > > I am building a flash tutorials section for my site > > > > http://www.innovativedesigns.org.uk > > > > The section is my first real attempt at using php+mysql without having > > to > > > > check the books or reference files :) > > > > Anyway here is my question: > > > > > > > > Can images be stored in the DB > > > > I am thinking no. This would me a long way round what I am trying to > do. > > > > > > > > cheers > > > > > > > > > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple flash php form, help please
Hi again guys :) I am having problems with this little email user script for my website. I have set this script here to run with flash outputing the information. When i run the script in the browser i grt this error "Warning: Failed to Receive in C:\apache\htdocs\innovat\forum\mailuser.php on line 18" I aint any php expert just some simple stuff i know. You can copy the code and test it just change the email information. cheers for any help guys. ",$ToSubject, $Message, "From: ".$username." <".$email.">");// line 18 print "retval=1&$ToEmail&ToSubject&$Message&$username&$email";// This just returns output to show all variables have been passed ok. ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date conflict with old news archive
God i hope this is simple :) I have news bloggs section on my site. At present the news is loaded in from a txt file, most of the site is now running with most sections being loaded via mysqldb's. I would like to add the old entries to the new db that i have setup for the bloggs. My problem is converting the date format from 12-08-03 to the time stamp to be stored int the db. It has to be done this way as new entries will be using the time stamp So in the php file i have $dateAdded = time(); but time would then be 1064245532 i need date=12-08-03 $dateAdded = date(convert) to time stamp cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date conflict with old news archive
Cheers your a star :) "Eugene Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, Sep 23, 2003 at 09:01:19PM +0100, [ PAUL FERRIE ] wrote: > : > : God i hope this is simple :) > > It is. I think. :-) > > : I have news bloggs section on my site. At present the news is loaded in > : from a txt file, most of the site is now running with most sections being > : loaded via mysqldb's. > : I would like to add the old entries to the new db that i have setup for the > : bloggs. > : My problem is converting the date format from 12-08-03 to the time stamp to > : be stored int the db. It has to be done this way as new entries will be > : using the time stamp > : > : So in the php file i have > : $dateAdded = time(); > : but time would then be 1064245532 > : i need > : date=12-08-03 > : $dateAdded = date(convert) to time stamp > > $dateAdded = mktime(0, 0, 0, 12, 8, 2003); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is this possible?
Hi guys, I am have created several websites(flash) with admin areas so that the clients can update sections of there site. I have created a little admin section on my own site(yet to be published). there is a client login area for client who's site's i have built. Here they have the option to change the login details for ther on DB's, follow? So far i have go it working. Details get updated on my server DB. Now it gets tricky for me. I am trying to figure out the best way of updating the clients db(Diffrent server) with the new login details. I thought i would do something like php:// Updates clients details on my DB server http://www.server1.com/php/common.php";; $common2="http://www.server2.com/php/common.php";; $common3="http://www.server3.com/php/common.php";; $common4="http://www.server4.com/php/common.php";; // include('$common1');//one of the four above $link = dbConnect(); // Attempt to authorise user with database $userID = auth($username, $password); // If authorisation failed... if ($userID == -1) { // Inform Flash and quit fail("Invalid username and/or password"); } //set new username and password $crypt2 = md5($password2); $query = "UPDATE admin SET username = '$username2', password = '$crypt2' WHERE userID = '$userID'"; if(!mysql_query($query)) { fail("Error updating admin"); } print "retval=1"; ?> Can the common.php file and the variables in this code be sent across the server? One other thing The Db's on the four severs are identical I hope i have explained what i am trying to do. cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] quick i need some help please
i have a admin section for a new site that i have built, to cut a long story short the submit form adds news stories to the site. For some reason behound me the php script is converting " to a square. It is a flash based admin area not yet sure if this is an issuse, i just got the call :( the font being used is a system defult font (arial). thanks Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: quick i need some help please
False alarm ! "Paul Ferrie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i have a admin section for a new site that i have built, to cut a long story > short > the submit form adds news stories to the site. For some reason behound me > the php script is converting " to a square. > It is a flash based admin area not yet sure if this is an issuse, i just got > the call :( > the font being used is a system defult font (arial). > > thanks > Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Alternet row colors
Hello all I have been working on this website http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm I did not design the site i have just been asked to tweak it My php knowledge is limited always learning something new. Anyways I have been trying to use a code that i got from www.hotscripts.com the scipts retutns alternet rows colors for information sent back from the database when displayed in the broswer. Here is the script: //--- function alternate_rows( // color_1 and color_2 have default values, but can be over-ridden. $data, $color_1 = '#99', $color_2 = 'black' ) { // Declare $color as static so it retains its value when program // execution leaves the local function's scope. static $color; // Set the color to that's not currently set. if ( $color == $color_1 ) { $color = $color_2; } else { $color = $color_1; } echo '' . $data . ''; } I have tried a few was of implamenting this into my current php code but i have had no luck :( Could some one help me with this please :) If you check the website and click "top ten" http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm The code for return the top ten result is : $result = mysql_query("SELECT * FROM albums where id <15"); $Count = @mysql_num_rows($result); echo "\n"; echo "IDARTISTTITLELABELPRICE\n"; for ($count = 0; $count < $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; printf("$id$artist$title$label £$price\n"); } echo "\n"; ?> Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alternet row colors
Thats pretty much what i have got off www.hotscripts.com. The problem is adding it to my exsisting code. ~cheers Paul "Boaz Yahav" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] You can also check : A PHP function To Make Alternative Colored table rows http://www.weberdev.com/get_example.php3?count=3609 Alternating background color for HTML table rows http://www.weberdev.com/get_example.php3?count=3482 Another way to alternate table rows http://www.weberdev.com/get_example.php3?count=1832 How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database) http://www.weberdev.com/get_example.php3?count=1761 HTML Table with random alternating colours, helps you see what you colour options are. http://www.weberdev.com/get_example.php3?count=1555 Sincerely berber Visit http://www.weberdev.com/ & http://www.weberblog.com/ Today!!! To see where PHP might take you tomorrow. Share your code : http://addexample.weberdev.com Search for PHP Code from your browser http://toolbar.weberdev.com Share your thoughts : http://www.weberblog.com/submit.php?type=story&topic=PHP_Web_Logs -Original Message- From: PAUL FERRIE [mailto:[EMAIL PROTECTED] Sent: Saturday, November 15, 2003 5:46 PM To: [EMAIL PROTECTED] Subject: [PHP] Alternet row colors Hello all I have been working on this website http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm I did not design the site i have just been asked to tweak it My php knowledge is limited always learning something new. Anyways I have been trying to use a code that i got from www.hotscripts.com the scipts retutns alternet rows colors for information sent back from the database when displayed in the broswer. Here is the script: //--- function alternate_rows( // color_1 and color_2 have default values, but can be over-ridden. $data, $color_1 = '#99', $color_2 = 'black' ) { // Declare $color as static so it retains its value when program // execution leaves the local function's scope. static $color; // Set the color to that's not currently set. if ( $color == $color_1 ) { $color = $color_2; } else { $color = $color_1; } echo '' . $data . ''; } I have tried a few was of implamenting this into my current php code but i have had no luck :( Could some one help me with this please :) If you check the website and click "top ten" http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm The code for return the top ten result is : $result = mysql_query("SELECT * FROM albums where id <15"); $Count = @mysql_num_rows($result); echo "\n"; echo "IDARTISTTITLELABELPRICE\n"; for ($count = 0; $count < $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; printf("$id$artist$title$label £$price\n"); } echo "\n"; ?> Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie stuck again
Here's what i have done. i have downloaded a very simple database manager from www.hotscripts.com. It allows me to edit, delete and add new information to the database. i have a couple of problems. 1. form field dont fill with all the data senback from the db to be edited, as fars as i am aware all fields except 'review' are long enough 2. In my common.php file for connecting to the db i have I have 2 tables in my database and would like to use a "drop down menu" to select the table we wish to view and edit. so taken $tablename out of the common.php file and having it sset within the main navigation. i am pretty sure i can set the drop down menu option but what is/would be the $query for returning how many and display table names? Cheers Paul http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie stuck again
Yeh cheers derek i dint think it would be something like that :P Can u ilabirate more on the $query structure? cheers Paul "Derek Ford" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PAUL FERRIE wrote: > > >Here's what i have done. i have downloaded a very simple database manager > >from www.hotscripts.com. It allows me to edit, delete and add new > >information to the database. i have a couple of problems. > > > >1. form field dont fill with all the data senback from the db to be edited, > >as fars as i am aware all fields except 'review' are long enough > > > >2. In my common.php file for connecting to the db i have > > > > > > > > >$database=mysql_connect ("localhost", "blah", "") or die ('I cannot > >connect to the database because: ' . mysql_error()); > >mysql_select_db ("***_vinrev"); > > > >$tablename="albums"; > >?> > > > >I have 2 tables in my database and would like to use a "drop down menu" to > >select the table we wish to view and edit. so taken $tablename out of the > >common.php file and having it sset within the main navigation. i am pretty > >sure i can set the drop down menu option but what is/would be the $query > >for returning how many and display table names? > > > >Cheers > >Paul > >http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html > > > > > > > your probably looking for something like 'show tables'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie stuck again
Cheers "Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sunday 16 November 2003 23:17, PAUL FERRIE wrote: > > Please spend a little time to think up a descriptive and relevant subject > heading. "newbie stuck again" does nothing to inform people of what your > problem is. > > > Here's what i have done. i have downloaded a very simple database manager > > from www.hotscripts.com. It allows me to edit, delete and add new > > information to the database. i have a couple of problems. > > > > 1. form field dont fill with all the data senback from the db to be > > edited, as fars as i am aware all fields except 'review' are long enough > > Can't help you unless you show some code. The most cause of this is because > you're not producing correct HTML, in particular you should enclose the > values of the attributes in quotes. > > > i am pretty > > sure i can set the drop down menu option but what is/would be the $query > > for returning how many and display table names? > > mysql_list_tables(), but read the manual entry before using. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > The difference between a Miracle and a Fact is exactly the difference > between a mermaid and a seal. > -- Mark Twain > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] create dropdown menu from returned $result
What am i overlooking? "; echo "". $tb_names[$i]." "; echo $tb_names[$i] . ""; $i++; } echo ""; ?> When tested heres what i get http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/table_list.php There are 2 tables within the DB 'reviews', 'albums' Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create dropdown menu from returned $result
I am trying to create a drop down menu to set varaible $tablrname Cheers paul "John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PAUL FERRIE wrote: > > > What am i overlooking? > > The part where you tell us what you're actually trying to achieve... > > > > include('common.php'); > > $result = mysql_list_tables("***_vinrev"); > > $i = 0; > > while ($i < mysql_num_rows ($result)) { > > $tb_names[$i]= mysql_tablename ($result, $i); > > echo ""; > > > > echo "". > > $tb_names[$i]." "; > > echo $tb_names[$i] . ""; > > Why are you echoing data and displaying between and > ... That's bad HTML. > > >$i++; > > } > >echo ""; > > ?> > > > > > > When tested > > heres what i get > > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/table_list.php > > There are 2 tables within the DB 'reviews', 'albums' > > So I see a select box with two options, 'reviews' and 'albums' that's > made from badly formed HTML. What are you trying to accomplish?? > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setting a global var so that all pages can see var
Hello again guys, thanks for the help over the past 48 hours :) Over the past week i have had the job of tweaking the php pages of a friends site. so far so good :) Now i am onto the admin area for running the website. I downloaded one of the many db managers scripts from www.hotscripts.com Luckly its a very simple app, easy to mod. Anyways most of my php knowledge is in conjuction with flash www.innovativedesigns.org.uk. most of the problems i have had here have been fairly simple to learn and fix. Now the job this week is with php+html (total newbie to this area). most of the problems i have been able to fix with some help from here as well. http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html ~This is the admin area. I manged to get the drop down menu working to select the revelent table and then set $tablename with the result being displayed in the next page as: $tablename table"; ?> The new page has 4 links to load other php files to edit,delete, view, and add new data to the DB On the links have: View database ~Now in the edit.php i have : $result = mysql_query("SELECT * FROM $tablename")or die("couldnt select table"); $tablename is not being passed with the link. What am i missing? Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setting a global var so that all pages can see var
lol i not that feeling whaen it come to flash based questions ;) Cheers] "Burhan Khalid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PAUL FERRIE wrote: > > > Hello again guys, thanks for the help over the past 48 hours :) > > > > Over the past week i have had the job of tweaking the php pages of a friends > > site. so far so good :) > > > > Now i am onto the admin area for running the website. I downloaded one of > > the many db managers scripts from www.hotscripts.com > > Luckly its a very simple app, easy to mod. Anyways most of my php knowledge > > is in conjuction with flash www.innovativedesigns.org.uk. most of the > > problems i have had here have been fairly simple to learn and fix. > > > > Now the job this week is with php+html (total newbie to this area). most of > > the problems i have been able to fix with some help from here as well. > > > > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html > > > > ~This is the admin area. I manged to get the drop down menu working to > > select the revelent table and then set $tablename with the result being > > displayed in the next page as: > > > print "MyAdmin database for $tablename table"; > > ?> > > The new page has 4 links to load other php files to edit,delete, view, and > > add new data to the DB > > On the links have: > > View database > > > > ~Now in the edit.php i have : > > $result = mysql_query("SELECT * FROM $tablename")or die("couldnt select > > table"); > > > > $tablename is not being passed with the link. > > > > What am i missing? > > RTFM @ http://www.php.net/security.registerglobals > STFA > > This question is another one of those twice daily ones. > > -- > Burhan Khalid > phplist[at]meidomus[dot]com > http://www.meidomus.com > --- > "Documentation is like sex: when it is good, > it is very, very good; and when it is bad, > it is better than nothing." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setting a global var so that all pages can see var
I am still stuck I now have this in the navigation page {$_GET['tablename']}"; } else { "$tablename did not get sent"; } ?> this gets the tablename from the previous page from the dropdown menu but still the other pages are not picking it up :( Please i need to get this working Cheers paul "Burhan Khalid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PAUL FERRIE wrote: > > > Hello again guys, thanks for the help over the past 48 hours :) > > > > Over the past week i have had the job of tweaking the php pages of a friends > > site. so far so good :) > > > > Now i am onto the admin area for running the website. I downloaded one of > > the many db managers scripts from www.hotscripts.com > > Luckly its a very simple app, easy to mod. Anyways most of my php knowledge > > is in conjuction with flash www.innovativedesigns.org.uk. most of the > > problems i have had here have been fairly simple to learn and fix. > > > > Now the job this week is with php+html (total newbie to this area). most of > > the problems i have been able to fix with some help from here as well. > > > > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html > > > > ~This is the admin area. I manged to get the drop down menu working to > > select the revelent table and then set $tablename with the result being > > displayed in the next page as: > > > print "MyAdmin database for $tablename table"; > > ?> > > The new page has 4 links to load other php files to edit,delete, view, and > > add new data to the DB > > On the links have: > > View database > > > > ~Now in the edit.php i have : > > $result = mysql_query("SELECT * FROM $tablename")or die("couldnt select > > table"); > > > > $tablename is not being passed with the link. > > > > What am i missing? > > RTFM @ http://www.php.net/security.registerglobals > STFA > > This question is another one of those twice daily ones. > > -- > Burhan Khalid > phplist[at]meidomus[dot]com > http://www.meidomus.com > --- > "Documentation is like sex: when it is good, > it is very, very good; and when it is bad, > it is better than nothing." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: setting a global var so that all pages can see var still :(
How would i pass tablename in the submit button? Check out edit record u wil see http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html Cheers Paul "Paul Ferrie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello again guys, thanks for the help over the past 48 hours :) > > Over the past week i have had the job of tweaking the php pages of a friends > site. so far so good :) > > Now i am onto the admin area for running the website. I downloaded one of > the many db managers scripts from www.hotscripts.com > Luckly its a very simple app, easy to mod. Anyways most of my php knowledge > is in conjuction with flash www.innovativedesigns.org.uk. most of the > problems i have had here have been fairly simple to learn and fix. > > Now the job this week is with php+html (total newbie to this area). most of > the problems i have been able to fix with some help from here as well. > > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html > > ~This is the admin area. I manged to get the drop down menu working to > select the revelent table and then set $tablename with the result being > displayed in the next page as: > print "MyAdmin database for $tablename table"; > ?> > The new page has 4 links to load other php files to edit,delete, view, and > add new data to the DB > On the links have: > View database > > ~Now in the edit.php i have : > $result = mysql_query("SELECT * FROM $tablename")or die("couldnt select > table"); > > $tablename is not being passed with the link. > > What am i missing? > > > Cheers > Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $query works but i still get a returned error
I am not sure what the problem is here. The script runs and deletes the relevent row but still returns "DATA from albums loaded row id 658 did not get sent Error deleting row! Warning: Cannot modify header information - headers already sent by (output started at /home/pferrie/public_html/vinrev/adm/deleteid.php:2) in /home/pferrie/public_html/vinrev/adm/deleteid.php on line 21 " {$_GET['tablename']} loaded"; } else { echo "$tablename did not get sent"; } if (isset($_GET['id'])) { echo "row id= {$_GET['id']}"; } else { echo "row id $id did not get sent"; } include("connection.php"); $query = mysql_query("DELETE FROM $tablename WHERE id= $id")or die("ther was an error tablename:= $tablename row id:= $id"); if(!mysql_query($query)) { echo"Error deleting row!"); } Header("Location: delete.php?success=$success"); ?> I am php newbie and might be missing the obviuos Cheers Paul example http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html "Delete record" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $query works but i still get a returned error
So your saying i should be using POST rather than GET? "John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PAUL FERRIE wrote: > > > I am not sure what the problem is here. The script runs and deletes the > > relevent row but still returns "DATA from albums loaded > > row id 658 did not get sent > > Error deleting row! > > Warning: Cannot modify header information - headers already sent by (output > > started at /home/pferrie/public_html/vinrev/adm/deleteid.php:2) in > > /home/pferrie/public_html/vinrev/adm/deleteid.php on line 21 > > You get this error because you echo display messages and errors before > trying to do a header() redirect. You can't have any output before header(). > > > " > > > if (isset($_GET['tablename'])) { > > echo "DATA from {$_GET['tablename']} loaded"; > > } else { > > echo "$tablename did not get sent"; > > } > > if (isset($_GET['id'])) { > > Take a look at your form again, you're using POST. > if(isset($_POST['id'])) { > > > echo "row id= {$_GET['id']}"; > > } else { > > echo "row id $id did not get sent"; > > But you must have register_globals still on because $id is set with the > same value as $_POST['id']... > > > } > > > > > > include("connection.php"); > > $query = mysql_query("DELETE FROM $tablename WHERE id= $id")or die("ther > > and that's why this query works, because $id is the correct value. > > > was an error tablename:= $tablename > > row id:= $id"); > > if(!mysql_query($query)) { > > echo"Error deleting row!"); > > } > > Header("Location: delete.php?success=$success"); > > > > ?> > > > > > > I am php newbie and might be missing the obviuos > > Might be missing the obvious, too. ;) > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Textfields dont fully populate
Hello again guys This week i have been on here and made a few posts regarding a small admin site app http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html Most of it is now working thank god, but still have have problems fully populating the textfields when i go to edit a record. Only one of the fields fully populates with the data returned from the $query If i view the source file via the broswer(right click / view source) i can see that the data has been sent ok But all i see is "cd" Anyone cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Textfields dont fully populate
Sorry m8 i am a total newbie to php+html, I dont get these problems with PHP+Flash Here is the code i am using to return the edit page with the data. $result = mysql_query("SELECT * FROM $tablename WHERE id= $id")or die("ther was an error tablename:= $tablename row id:= $id"); if ($myrow = mysql_fetch_array($result)) { echo "\n"; do { printf(" Artist Title Picture Review %s Label Format Price Rating \n", $myrow["id"], $artist=$myrow["artist"], $title=$myrow["title"], $picture=$myrow["picture"], $review=$myrow["review"], $lable=$myrow["label"], $format=$myrow["format"], $price=$myrow["price"], $rating=$myrow["rating"]); } while ($myrow = mysql_fetch_array($result)); echo ""; echo "\n"; } Cheers Paul "Bas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Paul Ferrie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hello again guys > > > >This week i have been on here and made a few posts regarding a small > > admin site app > > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html > > > > Most of it is now working thank god, but still have have problems fully > > populating the textfields when i go to edit a record. > > Only one of the fields fully populates with the data returned from the > > $query > > If i view the source file via the broswer(right click / view source) i can > > see that the data has been sent ok > > > > But all i see is "cd" > > Anyone > > > > cheers > > > > Paul > > Try to do it in double quotes(the query-data) > In an echo statement, there you must escape the double quotes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Textfields dont fully populate
Thank you Bas, i cant believe that once again it has been down to simple syntx cheers "Bas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] b1.pair.com... > Just change your code to: > > $result = mysql_query("SELECT * FROM $tablename WHERE id= $id")or > die("ther was an error >tablename:= $tablename >row id:= $id"); > > > if ($myrow = mysql_fetch_array($result)) { > echo "\n"; > do { > printf(" > Artist value='%s'> > Title value='%s'> > Picture value='%s'> > Review %s > Label value='%s'> > Format value='%s'> > Price value='%s'> > Rating value='%s'>\n", > $myrow["id"], > $artist=$myrow["artist"], > $title=$myrow["title"], > $picture=$myrow["picture"], > $review=$myrow["review"], > $lable=$myrow["label"], > $format=$myrow["format"], > $price=$myrow["price"], > $rating=$myrow["rating"]); > } while ($myrow = mysql_fetch_array($result)); > echo ""; > echo "\n"; > } > > I have not tested this, but it should work(it was a html-problem) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form with browse for file to upload "ftp"
Getting bit of a regular on here :) I am hoping that someone can point me to a script that allows me to attach a file to be uploaded to a set dir. I have already got the form built, except for a browse file option. The form is part of this admin area http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html Instead of having a textfield displaying a url of the image and the admin having to upload it sepratly i thought that i could get the admin to upload the image via the form. keeps it altogether. I wouldnt know were to begin adding this to the form. i am pretty sure there a pre-built script that can do this. Can someone point me to one. i had a quick look but came up with very little. Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form with browse for file to upload "ftp"
I am getting this error once i run the script Warning: move_uploaded_file(img/matrix.jpg): failed to open stream: Permission denied in /blah/blah Do i need to set the chmod of the img folder? Cheers Paul "Nathan Taylor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] There is nothing special to be done with the form itself for it to support file uploading aside from supply a browse field: As for uploading it, here's some untested code: if(!empty($_FILES['file']['tmp_name'])) { $name = strtolower(eregi_replace('#| |\?|!', '', $_FILES['file']['name'])); $destination = 'path/to/where/you/want/the/file/saved/'.$name; if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) { echo 'Successful'; } else { echo 'Failed'; } } - Original Message - From: PAUL FERRIE To: [EMAIL PROTECTED] Sent: Saturday, November 22, 2003 2:04 PM Subject: [PHP] Form with browse for file to upload "ftp" Getting bit of a regular on here :) I am hoping that someone can point me to a script that allows me to attach a file to be uploaded to a set dir. I have already got the form built, except for a browse file option. The form is part of this admin area http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html Instead of having a textfield displaying a url of the image and the admin having to upload it sepratly i thought that i could get the admin to upload the image via the form. keeps it altogether. I wouldnt know were to begin adding this to the form. i am pretty sure there a pre-built script that can do this. Can someone point me to one. i had a quick look but came up with very little. Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form with browse for file to upload "ftp"
eh? "Bronislav kluèka" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > User executing the script (www-data or nobody or some other user) has to > vave the permission to wotk with this directory. > > > > Brona > > > > I am getting this error once i run the script > > > > Warning: move_uploaded_file(img/matrix.jpg): failed to open stream: > > Permission denied in /blah/blah > > Do i need to set the chmod of the img folder? > > > > Cheers > > Paul > > > > > > "Nathan Taylor" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > There is nothing special to be done with the form itself for it to support > > file uploading aside from supply a browse field: > > > > > > > > As for uploading it, here's some untested code: > > > > if(!empty($_FILES['file']['tmp_name'])) { > > $name = strtolower(eregi_replace('#| |\?|!', '', > > $_FILES['file']['name'])); > > $destination = 'path/to/where/you/want/the/file/saved/'.$name; > > if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) { > > echo 'Successful'; > > } else { > > echo 'Failed'; > > } > > } > > - Original Message - > > From: PAUL FERRIE > > To: [EMAIL PROTECTED] > > Sent: Saturday, November 22, 2003 2:04 PM > > Subject: [PHP] Form with browse for file to upload "ftp" > > > > > > Getting bit of a regular on here :) > > > > I am hoping that someone can point me to a script that allows > > me to attach > > a > > file to be uploaded to a set dir. > > I have already got the form built, except for a browse file option. > > The form is part of this admin area > > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html > > Instead of having a textfield displaying a url of the image and > > the admin > > having to upload it sepratly i thought that i could get the admin to > > upload > > the image via the form. keeps it altogether. > > > > I wouldnt know were to begin adding this to the form. i am pretty sure > > there a pre-built script that can do this. Can someone point me to one. > > i > > had a quick look but came up with very little. > > > > Cheers > > Paul > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Form with browse for file to upload "ftp"
Got it working :) thanks for the help Paul "Paul Ferrie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Getting bit of a regular on here :) > > I am hoping that someone can point me to a script that allows me to attach a > file to be uploaded to a set dir. > I have already got the form built, except for a browse file option. > The form is part of this admin area > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html > Instead of having a textfield displaying a url of the image and the admin > having to upload it sepratly i thought that i could get the admin to upload > the image via the form. keeps it altogether. > > I wouldnt know were to begin adding this to the form. i am pretty sure > there a pre-built script that can do this. Can someone point me to one. i > had a quick look but came up with very little. > > Cheers > Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Could some one check my code
i am getting this error returned but i dont know why :( error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/pferrie/public_html/vinrev/adm/insert2.php on line 6 php file "; echo"Edit record"; } }else { if(!empty($_FILES['userfile']['tmp_name'])) { $name = strtolower(eregi_replace('#| |\?|!', '', $_FILES['userfile']['name'])); $destination = 'img/'.$name; if(move_uploaded_file($_FILES['userfile']['tmp_name'], $destination)) { $picture=$destination; $query = "INSERT INTO $tablename (artist, title, picture, review, label, format, price, rating)VALUES ('$artist', '$title', '$picture', '$review', '$label', '$format', '$price', '$rating')"; if(!mysql_query($query)) { fail("Error updating DB1"); } Header("Location: main.php?success=New row has been inserted into the database"); } } if(empty($userfile)) { $query2 = "INSERT INTO $tablename (artist, title, picture, review, label, format, price, rating)VALUES ('$artist', '$title', '$picture', '$review', '$label', '$format', '$price', '$rating')"; if(!mysql_query($query2)) { fail("Error updating DB2"); } Header("Location: main.php?success=New row has been inserted into the database"); } } ?> I am trying to check for a duplicate entry for rating and if one is found grab the row ID and then use it to load the edit page for the row. Anyone Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Change html links according to returned result
Right here goes :( Just when i thougfht i had done everything that had to be done the client wants something else as well. that something else is another 2 tables in the database that are of a diffrent layout from the original 2. This means i need to build a few more pages with diffrent layouts to acommidate the data being returned, this is fine. What my problem is: Here is the url to the admin area http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/index.html username: paul ferrie pass: admin the first 2 db's in the drop down menu are fine, it's the third and the fourth. I need to build a "if" statement that checks the name of tablename and then echo the relivent links Here is the code in the links page as it is -- {$_GET['tablename']} loaded "; } else { "$tablename did not get sent"; } ?> View database Search database Insert record Delete record Edit record - I had a tinker about witht the code but my php is not that good i was thinking something like: - {$_GET['tablename']} loaded "; } else { "$tablename did not get sent"; } if($tablename="blah"){ echo"View database" echo"Search database" echo"Insert record" echo"Delete record" echo"Edit record" }else if($tablename="blah2"){ and so on } ?> - I cant get the links to echo Any help much appreciated cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setting word wrap
Hi guys i wonder if someone could help me with this. http://thor.ancilenetworks.co.uk/~pferrie/vin/php/adm/ If you select table "reviews" and the press "view database" u will see that the text goes whey out to the right of the page making the bottom scrollbar kickin, this is not good. When i add a new record i have to press "RETURN" in a multi line text field for it to wrap in the data being sumbitted. I thought i could set the table width wich would make the text wrap, but as u can see this is not the case. Can anyone give me any help with this? cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setting word wrap
Ah Sorted cheers "Website Managers.Net" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Paul What you have entered there is not normal sentence structure. Since none of your characters have spaces between them, the browser has noplace to break into the next line. Try typing normal sentences including spaces and you will see that the browser will break at or near the right edge, depending on the size of the words. Even if you hyphenate a long word, the browser will have something to wrap. Also, change testing TO testing That will help define the margins. Jim www.websitemanagers.net - Original Message ----- From: "PAUL FERRIE" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, December 13, 2003 3:22 PM Subject: [PHP] setting word wrap | Hi guys i wonder if someone could help me with this. | | http://thor.ancilenetworks.co.uk/~pferrie/vin/php/adm/ | If you select table "reviews" and the press "view database" u will see that | the text goes whey out to the right of the page making the bottom scrollbar | kickin, this is not good. When i add a new record i have to press "RETURN" | in a multi line text field for it to wrap in the data being sumbitted. I | thought i could set the table width wich would make the text wrap, but as u | can see this is not the case. Can anyone give me any help with this? | | cheers | Paul | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, visit: http://www.php.net/unsub.php | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php