Jump to content

unknown1

Members
  • Posts

    128
  • Joined

  • Last visited

Everything posted by unknown1

  1. Yeah that seems to work fine... the error is gone but we have another issue. When it submits to the database the value is 0 and it should be either 1 or 2
  2. I know it's not a problem with the columns in database... cause if i use something like $sql = "INSERT INTO table (id_ListType) VALUES ('1')"; it works fine
  3. Hello, I was hoping to get some help if possible. I am trying to submit information from a radio button to a mysql database but keep getting an error Column count doesn't match value count at row 1 <p> <input name="listingtype" type="radio" value="1" />some value <input name="listingtype" type="radio" value="2" />Another value </p> <?php $listing_type = $_POST['listingtype']; $list_type['1']= false; $list_type['2']= false; $list_type[$_POST['listingtype']]= true; ?> $sql = "INSERT INTO table (id_ListType) VALUES ('$listing_type')"; It's a much bigger query but I added the basics... If anyone can help me out it sure would be appreciated, thanks. I know it's not a problem with the columns in database... cause if i use something like $sql = "INSERT INTO table (id_ListType) VALUES ('1')"; it works fine
  4. Thanks for the tips.... The view case does have a break at the end of it but also have more html before the break and didn't want to include the html for no reason it would have just made it harder to read =) so I actually just forgot to add it when I posted here. I knew before I even posted that it would be kinda hard to read but thought I would post anyway in hopes that someone could spot the problem. I may just have to rewrite the code... I just thought it would be something simple cause it does function ok it's just sending messages to the database twice.
  5. Not sure if this will help but <? case 'compose': if(!$_POST[send]){?> <div id="main_heading_text" class="left">My Inbox: Compose Message</div> <div id="main_list_buttons" class="right"></div> <div class="my_account_info" id="contentdiv" > <form method="post" action=""> <table width="680" border="0" cellspacing="0" cellpadding="0" style='border: 1px solid #E1F4A6; '> <tr> <td width="212" height="35" bgcolor="#E7F7A5"><br /> <span class="edit_profile_label" style="padding-left:8px;">User Name:</span> <? if(isset($_GET[user])){ //check if there is a user in the address bar echo "<input type='text' name='to' value='$_GET[user]' size='15'>"; //if there is }else{ //or not.. echo "<input type=\"text\" name=\"to\" size=\"15\">"; //echo the input box without the value of the user! } //end user check in address bar</b>?> </td> <td width="466" height="50" bgcolor="#E7F7A5" ><br /><b class="edit_profile_label" > Subject:</b><input type="text" name="title" value="My Offer" size="15"></td> </tr> <tr> <td height="125" colspan="2" valign="top" style="padding-left:8px;"><p> </p> <p> </p> <p><b class="edit_profile_label" style="font-size:14px;">Message:</b><br /><br /> <textarea name="message" rows="6" cols="75"></textarea> <br /><br /><br /><br /> </p></td> </tr> <tr> <td height="35" style="padding-left:8px;"><input type="submit" name="send" value="Send message" id="update_listing_btn" ><br /><br /></td> <td><a href="my_account.php?page=pm" style="font-size:12px; color:#00AEBF;">Back to inbox</a></td> </tr> <tr> <td height="35" bgcolor="#E7F7A5"> </td> <td bgcolor="#E7F7A5"> </td> </tr> </table> </form> <? }else{ //or if it was.... $to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to $from =$_SESSION[uSERNAME]; //who its from $date = date("F j, Y, g:i a"); //the date sent $msg = addslashes($_POST[message]); //the message variable $subject = addslashes($_POST[title]); //the subject $do = mysql_query("INSERT INTO `private_msg` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table! echo "<div id='main_heading_text' class='left'>My Inbox: Compose Message</div> <div id='main_list_buttons' class='right'></div> <div class='my_account_info' id='contentdiv' > <table width='680' border='0' cellspacing='0' cellpadding='0' style='border: 1px solid #E1F4A6; '> <tr> <td height='35' bgcolor='#E7F7A5'></td></tr> <tr><td><br /><br /><center>Message Sent! <a href=\"my_account.php?page=pm\" style=\"font-size:12px; color:#00AEBF; \">Go back to inbox</a></center><br /><br /></td></tr> <tr> <td height='35' bgcolor='#E7F7A5'></td></tr> </table>";?> <?}?> <? break; ?> <? case 'view': $id = (int)htmlspecialchars(strip_tags($_GET[id])); $msgs = mysql_query("SELECT * FROM `private_msg` WHERE `to` = '" . $_SESSION[uSERNAME] . "' ORDER BY `pid` ASC") or die(mysql_error()); //get all the messages to the loged in user $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe if(!$id){ $user_message = "<table width=\"680\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" class='private_msg_tbl' ><tr class=\"edit_profile_label\"> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td> <td width=\"680\" ><a href=\"pm.php\">Go back to inbox</a> <br /><br />No ID Selected!</td> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td></tr> </table>"; }else{ $select = mysql_query("SELECT * FROM `private_msg` WHERE `pid` = '" . $id . "';"); //get the message's info $msg = mysql_fetch_array($select); //select all data if($msg[to] != $_SESSION[uSERNAME]){ //check if the user logged $user_message= "<table width=\"680\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" class='private_msg_tbl'><tr class=\"edit_profile_label\"> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td> <td width=\"680\" ><a href=\"pm.php\">Go back to inbox</a><br /><br />This Message Was Not Sent To You</td> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td></tr> </table>"; }else{ //maybe... if(!$_POST[reply]) { //if the reply was not submitted $mark = mysql_query("UPDATE `private_msg` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read $message = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes $subject = stripslashes($msg[subject]); //strip the slashes $user_message="<table width=\"680\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" style='border: 1px solid #E1F4A6; ' ><form method=\"post\"> <tr > <td width='153' height='35' bgcolor='#E7F7A5' style='padding-left:7px;'><b class='edit_profile_label'>Subject:</b> $subject</td> <td width='507' bgcolor='#E7F7A5' style='padding-left:7px;' ><b class='edit_profile_label'>From:</b> $msg[from]</td> </tr> <div id='div_spacer'> <tr > <td height='100' colspan='2' style='padding-left:12px;'>$message</td> </tr> <tr> <td height='80' colspan='2' style='padding-left:8px;'><textarea rows=\"6\" cols=\"45\" name=\"msg\" ></textarea></td> </tr> <tr> <td height='35' style='padding-left:8px;'><input type=\"submit\" name=\"reply\" value=\"Reply\" style=' border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; width: 75px; font-weight: normal; color: #FFF; text-decoration: none; background-color: #00AEBF; height: 23px; float: left;'> </td> <td><a href=\"my_account.php?page=pm\" style=\"font-size:12px; color:#00AEBF; \">Go back to inbox</a></td> </tr> <tr> <td height='35' bgcolor='#E7F7A5'> </td> <td bgcolor='#E7F7A5'> </td> </tr> </table></form></div> "; }else{ $to = $msg[from]; //get who it is to $from =$_SESSION[uSERNAME]; //who its from $subject = "RE: " . $msg[subject]; //new subject $msg = addslashes($_POST[msg]); //the content $date = date("F j, Y, g:i a"); //the date sent $do = mysql_query("INSERT INTO `private_msg` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table! $user_message="<table width=\"680\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" class='private_msg_tbl' ><tr class=\"edit_profile_label\"> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td><tr> <td width=\"680\" >Message Sent!</td></tr> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td></tr> </table>"; echo "$user_message"; } } } ?>
  6. Very helpful. Smart ass! Anyways, I'm sure I will have to rewrite the code before anyone give me a str8 answer. Thanks!
  7. Anyways, it's going to the database twice.
  8. rofl, indeed. I'm sure I could have wrote it better but that's not the issue here. I didn't know good clean code was a prerequisite in order to get help.... I have my reasons for writing it this way. Regards!
  9. The other code is case view. I still can't see why it would submit to the database twice... the only thing I can see that maybe the issue is the reply and send conditions but the conditions are different on reply and send so I'm not sure how. <? case 'view': $id = (int)htmlspecialchars(strip_tags($_GET[id])); $msgs = mysql_query("SELECT * FROM `private_msg` WHERE `to` = '" . $_SESSION[uSERNAME] . "' ORDER BY `pid` ASC") or die(mysql_error()); //get all the messages to the loged in user $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe if(!$id){ $user_message = "<table width=\"680\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" class='private_msg_tbl' ><tr class=\"edit_profile_label\"> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td> <td width=\"680\" ><a href=\"pm.php\">Go back to inbox</a> <br /><br />No ID Selected!</td> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td></tr> </table>"; ?> <? }else{ $select = mysql_query("SELECT * FROM `private_msg` WHERE `pid` = '" . $id . "';"); //get the message's info $msg = mysql_fetch_array($select); //select all data if($msg[to] != $_SESSION[uSERNAME]){ //check if the user logged $user_message= "<table width=\"680\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" class='private_msg_tbl'><tr class=\"edit_profile_label\"> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td> <td width=\"680\" ><a href=\"pm.php\">Go back to inbox</a><br /><br />This Message Was Not Sent To You</td> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td></tr> </table>"; }else{ //maybe... if(!$_POST[reply]) { //if the reply was not submitted $mark = mysql_query("UPDATE `private_msg` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read $message = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes $subject = stripslashes($msg[subject]); //strip the slashes $user_message="<table width=\"680\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" style='border: 1px solid #E1F4A6; ' ><form method=\"post\"> <tr > <td width='153' height='35' bgcolor='#E7F7A5' style='padding-left:7px;'><b class='edit_profile_label'>Subject:</b> $subject</td> <td width='507' bgcolor='#E7F7A5' style='padding-left:7px;' ><b class='edit_profile_label'>From:</b> $msg[from]</td> </tr> <div id='div_spacer'> <tr > <td height='100' colspan='2' style='padding-left:12px;'>$message</td> </tr> <tr> <td height='80' colspan='2' style='padding-left:8px;'><textarea rows=\"6\" cols=\"45\" name=\"msg\" ></textarea></td> </tr> <tr> <td height='35' style='padding-left:8px;'><input type=\"submit\" name=\"reply\" value=\"Reply\" style=' border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; width: 75px; font-weight: normal; color: #FFF; text-decoration: none; background-color: #00AEBF; height: 23px; float: left;'> </td> <td><a href=\"my_account.php?page=pm\" style=\"font-size:12px; color:#00AEBF; \">Go back to inbox</a></td> </tr> <tr> <td height='35' bgcolor='#E7F7A5'> </td> <td bgcolor='#E7F7A5'> </td> </tr> </table></form></div> "; }else{ $to = $msg[from]; //get who it is to $from =$_SESSION[uSERNAME]; //who its from $subject = "RE: " . $msg[subject]; //new subject $msg = addslashes($_POST[msg]); //the content $date = date("F j, Y, g:i a"); //the date sent $do = mysql_query("INSERT INTO `private_msg` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table! $user_message="<table width=\"680\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"0\" class='private_msg_tbl' ><tr class=\"edit_profile_label\"> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td><tr> <td width=\"680\" >Message Sent!</td></tr> <td width=\"680\" height=\"35\" bgcolor=\"#E7F7A5\"> </td></tr> </table>"; echo "$user_message"; } } } ?>
  10. I have created a private message system but from some reason it's seems to post composed messages twice... The error is in the following code but can't see why it would be posting twice. Can someone please have a look and possibly help me figure out why. Thanks in advance!! <? case 'compose': if(!$_POST[send]){?> <div id="main_heading_text" class="left">My Inbox: Compose Message</div> <div id="main_list_buttons" class="right"></div> <div class="my_account_info" id="contentdiv" > <form method="post" action=""> <table width="680" border="0" cellspacing="0" cellpadding="0" style='border: 1px solid #E1F4A6; '> <tr> <td width="212" height="35" bgcolor="#E7F7A5"><br /> <span class="edit_profile_label" style="padding-left:8px;">User Name:</span> <? if(isset($_GET[user])){ //check if there is a user in the address bar echo "<input type='text' name='to' value='$_GET[user]' size='15'>"; //if there is }else{ //or not.. echo "<input type=\"text\" name=\"to\" size=\"15\">"; //echo the input box without the value of the user! } //end user check in address bar</b>?></td> <td width="466" height="50" bgcolor="#E7F7A5" ><br /><b class="edit_profile_label" > Subject:</b><input type="text" name="title" value="My Offer" size="15"></td> </tr> <tr> <td height="125" colspan="2" valign="top" style="padding-left:8px;"><p> </p> <p> </p> <p><b class="edit_profile_label" style="font-size:14px;">Message:</b><br /><br /> <textarea name="message" rows="6" cols="75"></textarea> <br /><br /><br /><br /> </p></td> </tr> <tr> <td height="35" style="padding-left:8px;"><input type="submit" name="send" value="Send message" id="update_listing_btn" ><br /><br /></td> <td><a href="my_account.php?page=pm" style="font-size:12px; color:#00AEBF;">Back to inbox</a></td> </tr> <tr> <td height="35" bgcolor="#E7F7A5"> </td> <td bgcolor="#E7F7A5"> </td> </tr> </table> </form> <? }else{ //or if it was.... $to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to $from =$_SESSION[uSERNAME]; //who its from $date = date("F j, Y, g:i a"); //the date sent $msg = addslashes($_POST[message]); //the message variable $subject = addslashes($_POST[title]); //the subject $do = mysql_query("INSERT INTO `private_msg` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table! echo "<div id='main_heading_text' class='left'>My Inbox: Compose Message</div> <div id='main_list_buttons' class='right'></div> <div class='my_account_info' id='contentdiv' > <table width='680' border='0' cellspacing='0' cellpadding='0' style='border: 1px solid #E1F4A6; '> <tr> <td height='35' bgcolor='#E7F7A5'></td></tr> <tr><td><br /><br /><center>Message Sent! <a href=\"my_account.php?page=pm\" style=\"font-size:12px; color:#00AEBF; \">Go back to inbox</a></center><br /><br /></td></tr> <tr> <td height='35' bgcolor='#E7F7A5'></td></tr> </table>";?> <?}?> <? break; ?>
  11. I have found a script that will work fine but just wont work fine for me =) It works great if you have windows hosting and the ability to run .exe files... But I don't, my hosting is linux so I need to find a way to do this on a linux box and limited access. If anyone has an idea of how I can do this on a linux hosting plan, it sure would help... I maybe able to get shell access if that helps at all.
  12. I don't think I have shell access but not 100% sure... In the case that I do how would I go about making this script?
  13. No control over server... it's hosted on godaddy. Any other ideas or options you can think of??
  14. I would like to create a script that will take screen shots of a sites home page and then create a thumb nail image of the screen shot. The issue is I can't seem to find any information on this at all and not even sure if this can be done in php. does anyone know if it can be done and is so point me in the right direction... Thanks in advance.
  15. is that even possible?? if so can someone please explain how. Thanks!!
  16. I want to take an array from a mysql database and make it into javascript variables e.g. $sql_nw = "select * from sit_details_tmp where id_site =" .$_GET['s_id']; $rec_nw = mysql_query($sql_nw) or die(mysql_error()); $num_nw = mysql_num_rows($rec_nw); // --------------- Display list of users -------------------------------// $rec_nw = mysql_query($sql_nw) or die(mysql_error()); while($rs_nw = mysql_fetch_array($rec_nw)) { echo "$rs_nw[url]"; } then take results and create a javascript array var $sitename = $rs_nw; Hope this explains what I'm trying to do...
  17. oh that was just an example =) not the code I'm trying to use. on this example I started with a blank value and it should be the other way around... Point is a have another variable that works the opposite and starts with blank and if condition is true has a value and it works fine... but when I try to do the reverse start with variable having a value and if condition is true value is blank it won't work. it's the same thing just reverse... also runs in the same condition as the other, this is crazy. Any ideas??????????
  18. I am trying to create a script where if a condition it true var text string has a value if not it doesn't /// Default vaules $notFound =""; $sitname = ''; $status = ''; $pageviews = ''; $verstatus = ''; $upgradesite = ''; $editsite = ''; $sql =mysql_query(select * from table); $numrows = mysql_num_rows($sql); if($numrows > 0){ $sitname = "Site Name"; $status = "Status"; $pageviews = "Views"; $verstatus = "Verification"; $upgradesite = "Upgrade"; $editsite = "Edit"; } The issue is it always shows up blank even when $numrows > 0 can anyone spot the issue??
  19. Is this even possible??
  20. Maybe a stupid question but is it possible to use javascript to query a mysql database?/ if so can someone explain how... Thanks!!
  21. I have a script that I created... and it has a database with user information. I have created a query that selects the users URL's from the database in an array... the variable for the user URL's is $row['Ur'l]; I want to use the Alexa Graph Widget from http://www.alexa.com/siteowners/widgets/graph in the code they have used a variable for user site as $sitename = [' '] but the issue is my content is dynamic so the URL doesn't become static till after the php is complete.... I tried to use $sitename = $row['Url']; as the site value but it didn't work. Can anyone tell me how I can use this widget and have the $sitename value be dynamic. Thanks!! <script type="text/javascript">/* <![CDATA[*/ $sitename = ['']; // USER-EDITABLE VARIABLES // enter up to 3 domains, separated by a space var sites = ['<? echo"$sitename"; ?>']; var opts = { width: 380, // width in pixels (max 400) height: 300, // height in pixels (max 300) type: 'r', // "r" Reach, "n" Rank, "p" Page Views range: '3m', // "7d", "1m", "3m", "6m", "1y", "3y", "5y", "max" bgcolor: 'e6f3fc' // hex value without "#" char (usually "e6f3fc") }; // END USER-EDITABLE VARIABLES AGraphManager.add( new AGraph(sites, opts) ); //]]></script>
  22. Didn't bump... fixed the 1st issues I needed help with and found another. Can you please elaborate on how I would go about writing the code in JavaScript... Thanks!!
  23. This will take todays date and add 90 days $today=date('m/d/y'); $theFuture=date('Y-m-d',strtotime($today.' + 90 days')); echo $theFuture;
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.