PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 13th, 2002, 11:06 PM
vaska vaska is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 18 vaska User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php: submit & query ????

i'm a newbie...trying to make my own basic blog (as all of them are so ugly and difficult to customize)...

can i do this?

<?

mysql_connect("localhost","vvvvv","vvvvv");
mysql_select_db("vvvvvv");

$query = mysql_query("SELECT * FROM content,response where response.a=content.blog and blog='$blog' " ) or die ("Unexpected error for MySQL database [1b]");
$row = mysql_fetch_array($query);

if ($submit){

mysql_query("insert into response (name,email,website,date,comments) values ('$name','$email','$website','$date','$comments')") or die ("ciao");

?>

it worked just find until i added the "submit" part...further down the page is a simple form to insert into the "response" table...but why might it not be working now?

any ideas or advice?

thanks...jv

Reply With Quote
  #2  
Old October 14th, 2002, 12:24 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: php: submit & query ????

At a glance ... you didn't terminate your if statement. What is the error msg?

Reply With Quote
  #3  
Old October 14th, 2002, 06:54 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: php: submit & query ????

I used to have problems with this when i first started, because i let DW make my forms, and then when i did if($submit) it wouldnt work.. as it needed to be Submit (capital S) not sure if thats your problem, sometimes its the simple things that are hardest to find....

Reply With Quote
  #4  
Old October 14th, 2002, 08:05 AM
vaska vaska is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 18 vaska User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: php: submit & query ????

i got it to work...now...i only have one problem to solve...

HOW do i get a loop to know specifically what to search for from a table? meaning...i have created a simple loop...but i want the loop to search a table based upon the record/id of another table...

example (if it's not clear)...

http://blog.vvvvvv.com/index.php?blog=1

the "1"...i want this number to be inserted directly into the loop query...like this...

$query="SELECT * FROM response where a=' 1 ' ";

but i can't do this with an include...doesn't work (at least to my knowledge of things - which isn't much)...

anybody got a quick solution?

thanks...jv

Reply With Quote
  #5  
Old October 14th, 2002, 12:36 PM
htmlartist htmlartist is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Houston, TX USA
Posts: 18 htmlartist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to htmlartist
RE: php: submit & query ????

When I click your link the only thing that pops up are like a bajillion domain registrar ads =/

From what I gather from your post, you are wanting the variable $blog to be inserted directly into the mysql query? If so, then you should be able to just put the variable into the query string like so:
$query="SELECT * FROM response where a='$blog'";

Reply With Quote
  #6  
Old October 14th, 2002, 04:01 PM
vaska vaska is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 18 vaska User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: php: submit & query ????

yo html...haha...you weren't supposed to really click on that...sorry...

thanks...but i did somehow figure that one out...it was pretty easy...with the help of this forum and a couple others...i've been able to achieve EVERYTHING i set out t do with my blog...i'm not a complete newbie...i'm a designer who has done websites before, but never got this deep with php (i've done really basic stuff in the past)...

one last piece of business though to solve...the below script is how i am inserting things into my tables...it's working just great...but...how can i make this code forward me directly back to the referring page? this is the code:

<?
$username="vvvvvv";
$password="vvvvv";
$database="vvvvvvvvvvvvvvv";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO response VALUES ('','$name','$email','$website','$date','$comments ','$a')";
mysql_query($query);

mysql_close();
?>

Reply With Quote
  #7  
Old October 14th, 2002, 11:10 PM
htmlartist htmlartist is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Houston, TX USA
Posts: 18 htmlartist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to htmlartist
RE: php: submit & query ????

It's great to see you are branching out into php. Once you get comfortable in it, you'll wonder how you ever got along without it hehehe.

What you are wanting to do can be done with the following command:
Code:
header("Location: http://www.vvvvvv.com");


Just keep in mind that when you use the header command, it has to be before any output is sent to the page, ie, you print out something or have html. If the code snipet you have above is the first/only thing on the page, then this should not be a problem.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > php: submit & query ????


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway