Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » By Chance does anyone know PGSQL?
Closed Thread
Old 11-22-2004, 08:51 PM   #1 (permalink)
 
Junior Techie

Join Date: Apr 2003

Posts: 53

Magma

Send a message via AIM to Magma Send a message via Yahoo to Magma
Default By Chance does anyone know PGSQL?

I have a problem on my site, the host upgraded the PGSQL Database and It gave me about 1000 Errors I have to slove.

Heres the most common/hardest to figure out.

Quote:
Warning: pg_exec() [function.pg-exec]: Query failed: ERROR: parser: parse error at end of input in /home/sites/wolverines/web/members/index.php on line 30

Warning: pg_fetch_array() expects parameter 1 to be resource, boolean given in /home/sites/wolverines/web/members/index.php on line 31
Code its using is

Code:
<?
$REMOTE_USER = $_POST['REMOTE_USER'];
$member = $_GET['member'];
$data = $_GET['data'];
$usr = $_GET['usr'];
?>
<?php
$pagetitle = 'Member Page';
$header_img = '/restricted.jpg';
require '../header.php';
?>

<?php
$result = pg_exec($db_, "
SELECT
	members.game_name,
	ranks.name AS rank,
	location,
	date_trunc('year', age(dob)) AS age,
	image_path,
	CASE WHEN picture=NULL THEN 0 ELSE 1 END AS picture,
	squads.name AS squad
FROM
	members JOIN
	current_rank ON (members.id = current_rank.member) JOIN
	ranks ON (current_rank.rank = ranks.id) JOIN
	squads ON (members.squad = squads.id)
WHERE
	members.id = ".$usr_data['id']."
");
$data = pg_fetch_array($result, 0);
?>
<?php if ($data['picture']) { ?>[img]/picture.cgi?member=<?php echo $usr_data['id']; ?>[/img]<?php } ?>
<H2>[img]/<?php echo $data['image_path']; ?>[/img] <?php echo $data['rank']; ?> <?php echo $REMOTE_USER; ?></H2>


<TABLE BORDER=0 CELLSPACING=1 CLASS="list">
<TR CLASS="<?php echo $styles[$s++ % sizeof($styles)]; ?>">
	<TD CLASS="fldname">Squad:</TD>
	<TD><?php echo $data['squad']; ?></TD>
</TR>
<TR CLASS="<?php echo $styles[$s++ % sizeof($styles)]; ?>">
	<TD CLASS="fldname">Location:</TD>
	<TD><?php echo $data['location']; ?></TD>
</TR>
<TR CLASS="<?php echo $styles[$s++ % sizeof($styles)]; ?>">
	<TD CLASS="fldname">Age:</TD>
	<TD><?php echo $data['age']; ?></TD>
</TR>
</TABLE></P>
<BR CLEAR="RIGHT">
<HR>
<?php
$result = pg_exec($db_, "
SELECT
	ladders.name,
        matches.map,
	matches.opponent,
	to_char(matches.date, 'Dy, DD-Mon-YYYY HH:MI PM') AS date,
	CASE WHEN (SELECT COUNT(*) FROM match_players WHERE match = matches.id AND member = rosters.member) = 1 THEN
		'Signed Up'
	ELSE
		'Not Signed Up'
	END AS sign,

        
	(SELECT COUNT(*) FROM match_players mp JOIN matches ON (mp.match = matches.id) WHERE member = rosters.member AND matches.ladder = ladders.id AND (first_half OR second_half) AND played) AS played,
matches.id AS matchid
FROM
	ladders JOIN
	rosters ON (ladders.id = rosters.ladder) JOIN
	matches ON (rosters.team = matches.team AND rosters.ladder = matches.ladder)
WHERE
	rosters.member = ".$usr_data['id']." AND
	NOT matches.played
ORDER BY
	matches.date,
	ladders.name 

");
$numrows = pg_numrows($result);
if ($numrows > 1) {
?>


<TABLE BORDER=0 CELLSPACING=1 CLASS="list">
<TR>

	<TH ROWSPAN=2>Ladder</TH>
	<TH ROWSPAN=2>Games
Played</TH>
	<TH COLSPAN=4>Next Match</TH>
</TR>
<TR>
	<TH>Map</TH>
        <TH>Opponent</TH>
	<TH>Date</TH>
	<TH>Status</TH>
</TR>
<?php
$row = 0;
do {
	$roster_row = pg_fetch_array($result, $row);
	printf("<TR CLASS=\"%s\">\n", $styles[$row % sizeof($styles)]);
	printf("\t<TD>%s</TD>\n", $roster_row['name']);
	printf("\t<TD ALIGN=\"RIGHT\">%d</TD>\n", $roster_row['played']);
	printf("\t<TD>%s</TD>\n", $roster_row['map']);
	printf("\t<TD>%s</TD>\n", $roster_row['opponent']);
	printf("\t<TD>%s</TD>\n", $roster_row['date']);
	if ($roster_row['date']) {
		printf("\t<TD><A HREF=\"/members/match_sign.php?match=%d\">%s</A></TD>\n", $roster_row['matchid'], $roster_row['sign']);
	} else {
		printf("\t<TD>N/A</TD>\n");
	}
	printf("</TR>\n");
	$row++;
} while ($row < $numrows);
?>
</TABLE></P>
<P ALIGN="CENTER">View All Upcoming Matches</P>
<P ALIGN="CENTER">My Match History</P>
<HR>
<?php } ?>
<?php
virtual('/unit-ribbons-map.cgi'.'?'.'member='.$usr_data['id']); 
virtual('/ribbons-map.cgi'.'?'.'member='.$usr_data['id']); 
virtual('/servicestripesmap.cgi'.'?'.'member='.$usr_data['id']); 
?>
<TABLE WIDTH="100%">
<TR>
	<TD ALIGN="CENTER" WIDTH="33%">Unit Ribbons</TD>
	<TD ALIGN="CENTER" WIDTH="33%">Individual Ribbons</TD>
	<TD ALIGN="CENTER" WIDTH="33%">Length of Service</TD>
</TR>
<TR>
	<td valign="top" ALIGN="CENTER">[img]/unit-ribbons.cgi?member=<?php echo $member//$usr_data['id'] ?>[/img]</td>
	<td valign="top" ALIGN="CENTER">[img]/ribbons.cgi?member=<?php echo $member//$usr_data['id'] ?>[/img]</td>
	<td valign="top" ALIGN="CENTER">[img]/servicestripes.cgi?member=<?php echo $member//$usr_data['id'] ?>[/img]</td>
</TR>
<?php
virtual('/wqbadges.cgi'.'?'.'member='.$usr_data['id']); 
?>
</TABLE>
<P ALIGN="CENTER">View Awards Page</P>
<?php require '../footer.php'; ?>
Problem seems be saying its ");

but isnt that right...
__________________
http://img165.imageshack.us/img165/8...r562600sj9.gif
CPU:AMD 3000+
RAM:1gb PC 3200
GFX:Nvidia FX5200 128mb
HDD:120gb 7200rpm, 200gb 7200rpm
OS:Windows XP Home SP1+2

Half-Life 2 Completed in Under 11 Hours
Magma is offline  
Old 12-01-2004, 08:48 PM   #2 (permalink)
 
Junior Techie

Join Date: Apr 2003

Posts: 53

Magma

Send a message via AIM to Magma Send a message via Yahoo to Magma
Default

no way..no one can help me?
__________________
http://img165.imageshack.us/img165/8...r562600sj9.gif
CPU:AMD 3000+
RAM:1gb PC 3200
GFX:Nvidia FX5200 128mb
HDD:120gb 7200rpm, 200gb 7200rpm
OS:Windows XP Home SP1+2

Half-Life 2 Completed in Under 11 Hours
Magma is offline  
Old 12-02-2004, 10:48 PM   #3 (permalink)
 
Newb Techie

Join Date: Nov 2004

Posts: 28

Windwaker222

Default

have no idea of pgsql but from what the error is saying, you should try changing the 0 to a 1 on line 30

$data = pg_fetch_array($result, 0);

too

$data = pg_fetch_array($result, 1);
Windwaker222 is offline  
 
Closed Thread

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On