/    Sign up×
Community /Pin to ProfileBookmark

Pulling Dates from MySql problem

I am pulling dates from MySql using two tables. The first has the main record information. The second has the dates with the corrosponding recod Id from the first table.

The problem I’m am having is that when I pull the date records I am missing the first record.

here’s the MySql code:

[code=php]

$colname_campset = “1”;
if (isset($HTTP_GET_VARS[‘cnum’])) {
$colname_campset = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS[‘cnum’] : addslashes($HTTP_GET_VARS[‘cnum’]);
}
mysql_select_db($database_hodp, $hodp);
$query_campset = sprintf(“SELECT * FROM camps WHERE cnum = %s”, $colname_campset);
$campset = mysql_query($query_campset, $hodp) or die(mysql_error());
$row_campset = mysql_fetch_assoc($campset);
$totalRows_campset = mysql_num_rows($campset);

$query_cdwset1 = “SELECT * FROM campdw WHERE cnum = “.$row_campset[‘cnum’].” AND campday > 0 ORDER BY cnum DESC”;
$cdwset1 = mysql_query($query_cdwset1, $hodp) or die(mysql_error());
$row_cdwset1 = mysql_fetch_assoc($cdwset1);

[/code]

and the while loop for the dates:

[code=php]

<?php
$counter=0;
while($i=mysql_fetch_object($cdwset1)){
$counter++;
$cdate = get_db_date($i->campday,’M d, Y’);

echo “t<input type=checkbox name=dckbox”.$counter.” onClick=count(this.form)>&nbsp;”.$cdate;
if(fmod($counter,2)!=0){
//the row is odd
echo(“n</td></tr>nn<tr><td>n”);
}else{
//the row is even
echo(“n</td>n<td>”);
}
} ?>

[/code]

thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsJun 04.2004 — the problem is you use two mysql_fetch_assoc() on the same result
Copy linkTweet thisAlerts:
@JohnMyklauthorJun 04.2004 — Now if someone would help me with my javascript I would be well off for the night
×

Success!

Help @JohnMykl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...