PHP programmer needed
Moderator: General Moderators
-
utahfriend
- Forum Commoner
- Posts: 34
- Joined: Thu Nov 10, 2005 12:25 pm
- Location: Bountiful, Utah
PHP programmer needed
I need someone who is willing to do some trouble shooting of php programs that was written by a local IT guy and then he left me hanging with some of the things not working. I am willing to pay cash for the help!
-
utahfriend
- Forum Commoner
- Posts: 34
- Joined: Thu Nov 10, 2005 12:25 pm
- Location: Bountiful, Utah
feyd | Please use
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
One problem I am having is that when I do a SELECT with MYsql, it doesn't work if I use the WHERE clause, as below:Code: Select all
function dd_template($template_id=0)
{
$text = "<option value='Select' selected='selected'>Select</option>";
//$sql = "SELECT * FROM members_cat order by cat_name";
$sql = "SELECT cat_id,cat_name FROM members_cat where user_id=$user_id order by cat_name";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$text .= "<option value='$row[cat_name]'";
if ($row["cat_id"] == $cat_id)
{
$text .= " Selected";
}
$text .= "> $row[cat_name]</option>\n";
}
$text .= "</select>";
return $text;
}feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]Code: Select all
function dd_template($template_id=0)
{
$text = "<option value='Select' selected='selected'>Select</option>";
//$sql = "SELECT * FROM members_cat order by cat_name";
$sql = "SELECT cat_id, cat_name FROM members_cat where `user_id` = '".$user_id."' order by cat_name";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$text .= "<option value='$row[cat_name]'";
if ($row["cat_id"] == $cat_id)
{
$text .= " Selected";
}
$text .= "> $row[cat_name]</option>\n";
}
$text .= "</select>";
return $text;
}-
utahfriend
- Forum Commoner
- Posts: 34
- Joined: Thu Nov 10, 2005 12:25 pm
- Location: Bountiful, Utah
print out your SQL query to make sure your variables are set.
Code: Select all
echo $yoursqlquery;Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
-
utahfriend
- Forum Commoner
- Posts: 34
- Joined: Thu Nov 10, 2005 12:25 pm
- Location: Bountiful, Utah
-
utahfriend
- Forum Commoner
- Posts: 34
- Joined: Thu Nov 10, 2005 12:25 pm
- Location: Bountiful, Utah
Jcart | Please use
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
The same code that we just fixed pulls categories from a database and allows a user to change the category assigned to a client. When he opens the page to edit the client, the drop down menu shows "select" If the user makes a change somewhere else on the form and leaves this unchanged, when saved it makes the category change to "Select". How can I make the drop down menu show in the window what is currently saved so that when it is resaved, it does not change the category unless the user makes the change in the drop down menu?
You can see what I am talking about by going to http://store.globalmarketingplus.com/Us ... rlist.html and then click on the word edit on any line and looking at the two dropdown menus I have there.
This is the code we are working on:Code: Select all
function dd_template($template_id=0)
{
$text = "<option value='Select' selected='selected'>Select</option>";
//$sql = "SELECT * FROM members_cat order by cat_name";
$sql = "SELECT cat_id, cat_name FROM members_cat where `user_id` = '".$user_id."' order by cat_name";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$text .= "<option value='$row[cat_name]'";
if ($row["cat_id"] == $cat_id)
{
$text .= " Selected";
}
$text .= "> $row[cat_name]</option>\n";
}
$text .= "</select>";
return $text;
}
Thank youJcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Start using tags! 
Code: Select all
-
utahfriend
- Forum Commoner
- Posts: 34
- Joined: Thu Nov 10, 2005 12:25 pm
- Location: Bountiful, Utah
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
Code: Select all
function dd_template($template_id=0)
{
$text = "<option value='Select'>Select</option>";
//$sql = "SELECT * FROM members_cat order by cat_name";
$sql = "SELECT cat_id, cat_name FROM members_cat where `user_id` = '".$user_id."' order by cat_name";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$text .= "<option value='$row[cat_name]'";
if ($row["cat_id"] == $cat_id)
{
$text .= " Selected";
}
$text .= "> $row[cat_name]</option>\n";
}
$text .= "</select>";
return $text;
}shiznatix@wesmokerocks.com
-
utahfriend
- Forum Commoner
- Posts: 34
- Joined: Thu Nov 10, 2005 12:25 pm
- Location: Bountiful, Utah
$cat_id is part of the database and $user_id is a session variable.
I copied and pasted the code you sent in your last post, but it is still not highlighting the previous saved field, it shows "Selected" which will change the field to "Selected" if saved. You can see what it is doing at http://store.globalmarketingplus.com/Us ... tailsId=12
Thanks
I copied and pasted the code you sent in your last post, but it is still not highlighting the previous saved field, it shows "Selected" which will change the field to "Selected" if saved. You can see what it is doing at http://store.globalmarketingplus.com/Us ... tailsId=12
Thanks
HAHA wesmokerocks.com hahahahashiznatix wrote:shiznatix@wesmokerocks.com
No, $row['cat_id'] comes from the database. Where does $cat_id come from? Is it defined in the main part of the script? Also $template_id is never used. Maybe that should be $cat_id?utahfriend wrote:$cat_id is part of the database and $user_id is a session variable.
Code: Select all
function dd_template($cat_id=0)