Jump to content


Photo

Problems with posting a message Can you find any error in this code???


  • Please log in to reply
7 replies to this topic

#1 bidoncomics

bidoncomics
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationIndiana

Posted 22 August 2006 - 02:26 PM

Hello all,

My name is Rich and I own and run http://bidoncomics.com

I purchased the php template for the site ( I'm currently learning php ) and I have a problem I cant figure out.

In the auction descriptions the bidder has a choice to post a public message or send it to the seller. Well the send it to seller works fine. But when they choose to post it public the email is sent to the seller that they have a public question but the question is not posted. I have the section of code below. Can anyone spot something I'm missing or is there a file I need to have on my server that maybe I'm missing? The database is set up.

If nothing else what would I have to do to eliminate the public post and only leave the send seller the question part.

Thanks guys for the help. I have actually been reading the boards awhile now getting tips as I learn just never posted.

<!-- Header Ask Seller a Question Section (Public and Private questions) --> 

<? header5(strtoupper($lang[askseller]));?>

<? $getPublicMsg = mysql_query("SELECT * FROM probid_public_msg WHERE auctionid='".$_GET['id']."' AND msgtype='Q'") or die(mysql_error());
$isPublicMsg = mysql_num_rows($getPublicMsg); 
if ($isPublicMsg>0) { ?>
<table width="100%" border="0" cellspacing="2" cellpadding="2"> 
 <? while ($publicMsg = mysql_fetch_array($getPublicMsg)) { ?>
  <tr class="c3"> 
     <td width="11" align="center"><img src="themes/<?=$setts['default_theme'];?>/img/system/q.gif"></td> 
     <td width="60"><strong><?=$lang[question];?></strong></td> 
     <td><?=$publicMsg['content'];?></td> 
  </tr><? 
	$answer = getSqlField("SELECT content FROM probid_public_msg WHERE answerid='".$publicMsg['id']."'","content");
  	if ($_SESSION['memberid']!=$auctionDetails['ownerid']) {
	  	if ($answer!=""&&$answer!="n/a") { ?>
  <tr class="c2"> 
     <td width="11" align="center"><img src="themes/<?=$setts['default_theme'];?>/img/system/a.gif"></td> 
     <td width="60"><strong><?=$lang[answer];?></strong></td> 
     <td><?=$answer;?></td> 
  </tr><? 
  		}
	} else { ?>
  <form action="auctiondetails.php" method="get">
  <input type="hidden" name="id" value="<?=$_GET['id'];?>">
  <input type="hidden" name="answerid" value="<?=$publicMsg['id'];?>">
  <tr class="c2"> 
     <td width="11" align="center"> </td> 
     <td><strong><?=$lang[answer];?></strong></td> 
     <td><textarea name="content" cols="60" rows="2" class="contentfont"><?=$answer;?></textarea>
	 &nbsp; <input type="submit" value="<?=$lang[answer];?>" name="postanswerok"></td> 
  </tr>
  </form>
  <? } ?> 
  <tr> 
     <td align="center" colspan="3" class="c4"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td> 
  </tr> 
  <? } ?>
</table>
<? } ?>
<table width="100%" border="0" cellspacing="0" cellpadding="5"> 
<? if ($_SESSION['membersarea']=="Active"&&$_SESSION['accsusp']!=2) { ?>
<? if ($_SESSION['memberid']==$auctionDetails['ownerid']) { ?>
  <tr class="c2"> 
     <td align="center"><?=$lang[plsanswerqs];?></td> 
  </tr> 
<? } else if ($auctionDetails['closed']==1) { ?>  
  <tr class="c2"> 
     <td align="center"><?=$lang[errorauctclosednoq];?></td> 
  </tr> 
<? } else { ?>  
<form action="auctiondetails.php" method="get"> 
  <input type="hidden" name="id" value="<?=$_GET['id'];?>"> 
  <tr>
     <td>
	  <table width="100%" border="0" cellpadding="2" cellspacing="2" align="center" class="border"> 
		 <tr class="contentfont" valign="top">
		 	<td class="c2" width="10"><img src="themes/<?=$setts['default_theme'];?>/img/system/i_faq.gif"></td>
		  <td class="c2" align="right" width="20%"><strong><?=$lang[askseller];?></strong></td> 
		  <td class="c3"><textarea name="message" cols="40" rows="3" class="contentfont"></textarea></td>
		  <td class="c3" width="80%">
		  <div style="padding: 2px;">
		  <select name="question_type">
		   <? $publicQ = getSqlField("SELECT default_public_questions FROM probid_users WHERE id='".$auctionDetails['ownerid']."'","default_public_questions");
			if ($publicQ == "Y"&&$setts['enable_asq']=="Y") { ?><option value="public" selected><?=$lang[postqpublic];?></option><? } ?>
		   <option value="private"><?=$lang[postqprivate];?></option>
		  </select>
		  </div>
		  <div style="padding: 2px;">
		  <input name="postquestionok" type="submit" id="postquestionok" value="<?=$lang[submit]?>">
		  </div>
		  </td>
		 </tr> 
	   </table> 
	 </td> 
  </tr> 
</form> 	 
<? } ?>
<? } else { ?>
  <tr class="c2"> 
     <td align="center" class="contentfont">[ <a href="login.php?auctionid=<?=$_GET['id'];?>"><?=$lang[logintopostqs];?></a> ]</td> 
  </tr> 
<? } ?>
</table>
<br>
<? }
$mainCat_primary = getMainCat($auctionDetails['category']);
$mainCat_secondary = getMainCat($auctionDetails['addlcategory']);

$getFields = mysql_query("SELECT DISTINCT f.boxid, f.boxname, f.boxtype, d.boxvalue FROM 
probid_fields_data d, probid_fields f WHERE d.auctionid='".$_GET['id']."' AND f.active='1' AND d.boxid = f.boxid AND 
(f.categoryid='".$mainCat_primary."' OR f.categoryid='".$mainCat_secondary."' OR f.categoryid='0') ORDER BY f.fieldorder ASC") or die(mysql_error()); 
$isFields = mysql_num_rows($getFields);
if ($isFields) { ?>

Rich Syndram
CEO
Http://BIDonCOMICS.com

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 22 August 2006 - 05:02 PM

Welcome to the forums... or should I say welcome to posting on these forums!?  ;)

We might need a little more information:

1) What have you done to try and fix it?
2) When you say it's not posted, does it just show a blank area or are you getting an error?
3) Is getSqlField a custom function, and if so, can you post that code?  It may be how that works that is fouling up the rest of your processing.

Info: PHP Manual


#3 bidoncomics

bidoncomics
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationIndiana

Posted 22 August 2006 - 05:37 PM

Welcome to the forums... or should I say welcome to posting on these forums!?  ;)

We might need a little more information:

1) What have you done to try and fix it?

Nothing because since i'm still learning the language I didn't want to screw it up.

2) When you say it's not posted, does it just show a blank area or are you getting an error?

When the bidder types in his question then hits submit the screen flashes (like if it was sent) then they are right back to the description page. No errors are sent. And the email is sent to the seller letting them know their is a public question waiting to be answered. But when you go to that auction nothing was posted to the description.

3) Is getSqlField a custom function, and if so, can you post that code?  It may be how that works that is fouling up the rest of your processing.

I will look into this and find out and post the code here.


Thank you for the help.
Rich Syndram
CEO
Http://BIDonCOMICS.com

#4 bidoncomics

bidoncomics
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationIndiana

Posted 23 August 2006 - 02:21 PM

If anyone would like to take a look at this for us, let me know. I cant figure it out. Still to much of a noob..
Rich Syndram
CEO
Http://BIDonCOMICS.com

#5 lessthanthree

lessthanthree
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationUK

Posted 23 August 2006 - 02:22 PM

Did you find the code for getSqlField?
call me a safe bet, i'm betting i'm not

#6 bidoncomics

bidoncomics
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationIndiana

Posted 23 August 2006 - 03:34 PM

Did you find the code for getSqlField?


No and i have found getSqlNumber  but I'm not sure where I should look. Would it be on the same page? Wow I hate being the noob..lol
Rich Syndram
CEO
Http://BIDonCOMICS.com

#7 lessthanthree

lessthanthree
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationUK

Posted 23 August 2006 - 03:35 PM

Is there a file in the site somewhere called functions.php or core.php or similar? It might be in there if there is, it depends on how the site was developed.
call me a safe bet, i'm betting i'm not

#8 bidoncomics

bidoncomics
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationIndiana

Posted 23 August 2006 - 03:48 PM

I found this in  formchecker.php

## ask seller a question
if (isset($_GET['postquestionok'])) {
	$fv=new FormValidator();
	$feedback = $_POST['message'];
	
	$fv->isEmpty('message',"$lang[formcheck_askq_empty]");
	$fv->isHtml('message',"$lang[formcheck_askq_html]");	
	if ($fv->isError()) {
		$errors = $fv->getErrorList();
		echo "<br><blockquote> <p class=\"contentfont\">		\n";
		echo "<b>$lang[formcheck_err]</b>						\n";
		echo "<p class=contentfont> $lang[formcheck_resubmit]:	\n";
		echo "<ul class=smallfont>";
		foreach ($errors as $e) {
			echo "<li>" . $e['msg'];
		}   
		echo "</ul>";
		$fv->resetErrorList();
		echo "</p></blockquote>";
		$action="";
	} else {
		$action="submit_question";
	}
}

## answer public question
if (isset($_GET['postanswerok'])) {
	$fv=new FormValidator();
	$feedback = $_POST['content'];
	
	$fv->isEmpty('content',"$lang[formcheck_pubans_empty]");
	$fv->isHtml('content',"$lang[formcheck_pubans_html]");	
	if ($fv->isError()) {
		$errors = $fv->getErrorList();
		echo "<br><blockquote> <p class=\"contentfont\">		\n";
		echo "<b>$lang[formcheck_err]</b>						\n";
		echo "<p class=contentfont> $lang[formcheck_resubmit]:	\n";
		echo "<ul class=smallfont>";
		foreach ($errors as $e) {
			echo "<li>" . $e['msg'];
		}   
		echo "</ul>";
		$fv->resetErrorList();
		echo "</p></blockquote>";
		$action="";
	} else {
		$action="submit_answer";
	}
}
?>

Rich Syndram
CEO
Http://BIDonCOMICS.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users