Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-09-2009, 07:20 PM Else if statment
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Hi
I have a situation that need to do
[CODE]
$sql2="select * from agents where id='$id' limit 1 ";
$result2=mysql_db_query("DB",$sql2);
$regist2=mysql_fetch_array($result2);
$name=$regist2["name"];
and so on....
TO CHANGE EXISTENT USER DATA:
<table>
<tr>
<td>
<? if($id){ ?>
ID: <? echo $id ?>
</td>
</tr>

<? } ?>
TO CREATE A NEW USER:
<tr>
<td>
<? } else if ($activ==0 ) { ?>
Register: New User
</td>
</tr>
<? } ?>
</table>

DATA COMMON TO BOTH SITUATIONS:
<table>
<tr>
<td width="121" align="right"><span class="style3">Nome (Broker/Agent)</span></td>
<td colspan="2" align="left"><input name="nome" type="text" class="input" id="nome" value="<? echo $nome ?>" size="62" /></td>
</tr>
and so on...
<tr>
<td align="center">&nbsp;</td>
<td align="left"><input type="submit" name="<? if(!$id) { echo "Save"; } else { echo"Change"; } ?>" id="button" value="<? if(!$id) { echo "Save"; } else { echo"Change"; } ?>" >
</td>
</tr>
</table>

Now: The first situation is no problem. The changes are saving in the DB.
But the second is not saving.
can somebody explain-me why?
thanks
josil is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-09-2009, 08:21 PM Re: Else if statment
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I don't understand your issue....
If you want to include code, include it all.
If you want to give us pseudo code, give it complete.

You gave us some bit of php, without sql logic and out of context, and you expect us to tell you where the problem is ?
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 12-10-2009, 07:48 AM Re: Else if statment
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by tripy View Post
I don't understand your issue....
If you want to include code, include it all.
If you want to give us pseudo code, give it complete.

You gave us some bit of php, without sql logic and out of context, and you expect us to tell you where the problem is ?
Thanks for your reply.

here it is the two file attached that with a full codes.

I hope that you can understand better now.

Thanks
Attached Files
File Type: txt test.txt (34.0 KB, 4 views)
File Type: txt test1.txt (1.1 KB, 3 views)
josil is offline
Reply With Quote
View Public Profile
 
Old 12-10-2009, 10:05 AM Re: Else if statment
Super Talker

Posts: 139
Name: John Davis
Trades: 0
1. Where from $id comes?
2. Is there some error/warnig messages? (switch on the messages display)
__________________
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
»
Please login or register to view this content. Registration is FREE
for web developers
MapMaster is offline
Reply With Quote
View Public Profile Visit MapMaster's homepage!
 
Old 12-10-2009, 11:52 AM Re: Else if statment
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by MapMaster View Post
1. Where from $id comes?
2. Is there some error/warnig messages? (switch on the messages display)
At the begining I made a code without the else if, just to create a NEW USER. It worked ok. But now due the fact I need time to time to change USERS DATA I introduced the statment else if, then I end up having problems to create NEW USERS, but manage to change USERS DATA without a problem.

the steps are :

1. register new user. That's where I have a problem. If I don't use the else if situation I can register the new user. It record into DB.

2. If a user is created, it's Id is the ID of the DB (autoincrement).
That is working. The <? echo $id ?> is to give-me the ID of the already created user.

Hope this clarify you.
josil is offline
Reply With Quote
View Public Profile
 
Old 12-11-2009, 07:59 AM Re: Else if statment
Super Talker

Posts: 139
Name: John Davis
Trades: 0
I can't see the $Salvar variable creation in you code. And you?
__________________
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
»
Please login or register to view this content. Registration is FREE
for web developers
MapMaster is offline
Reply With Quote
View Public Profile Visit MapMaster's homepage!
 
Old 12-12-2009, 07:20 AM Re: Else if statment
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by MapMaster View Post
I can't see the $Salvar variable creation in you code. And you?

Hi

I'ved translated the code for you due be in portuguese language. It is $Save ($Salvar)

Thanks for the trouble
josil is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Else if statment
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.76546 seconds with 13 queries