MySQL Forums
Forum List  »  Other Migration

Mysql4 to Mysql5 migration problem - SQL Syntax
Posted by: John Benobi
Date: January 05, 2013 08:59PM

Hi,
I changed mysql4 to mysql5 and have a problem.
Propably this query from mysql4 (worked there fine) gives me syntax error in mysql5:

$q="select gs_hr.rin$hr as rin,gs_hr.uin$hr as uin,gs_hr.cl$hr as cl,gs_hr.out$hr as out,gs_hr.f$hr as f,gs_hr.a$hr as a,gs_hr.rin$hrl as rinhrl,gs_hr.out$hrl as outhrl,gs_hr.d as d,gs_tr.r as r,gs_tr.t as t,gs_tr.tr as tr,gs_tr.otr as otr,gs_tr.htr as htr,gs_tr.hotr as hotr,gs_tr.dowed as dowed,gs_tr.a as ca,gs_tr.drin as drin,gs_tr.dout as dout,gs_tr.etr as etr from gs_hr,gs_tr where gs_hr.d=gs_tr.d";

Echo shows me:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'out,gs_hr.f4 as f,gs_hr.a4 as a,gs_hr.rin3 as rinhrl,gs_hr.out3 as outhrl,gs_hr.' at line 1
On site is got error: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ... 131

Lines 129-131:

129 | $q="select gs_hr.rin$hr as rin,gs_hr.uin$hr as uin,gs_hr.cl$hr as cl,gs_hr.out$hr as out,gs_hr.f$hr as f,gs_hr.a$hr as a,gs_hr.rin$hrl as rinhrl,gs_hr.out$hrl as outhrl,gs_hr.d as d,gs_tr.r as r,gs_tr.t as t,gs_tr.tr as tr,gs_tr.otr as otr,gs_tr.htr as htr,gs_tr.hotr as hotr,gs_tr.dowed as dowed,gs_tr.a as ca,gs_tr.drin as drin,gs_tr.dout as dout,gs_tr.etr as etr from gs_hr,gs_tr where gs_hr.d=gs_tr.d";
130 | $r=mysql_query($q);
131 | while($row=mysql_fetch_array($r)){$d=$row["d"];

Please help

I need this query working on mysql5.
Could you please help me convert it ?

Benobi



Edited 1 time(s). Last edit at 01/06/2013 04:02AM by John Benobi.

Options: ReplyQuote


Subject
Views
Written By
Posted
Mysql4 to Mysql5 migration problem - SQL Syntax
6453
January 05, 2013 08:59PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.