error with mysql fetch array

e107 CMS » Forums » Miscellaneous » Code << Previous thread | Next thread >>
josicoesp
Jul 26 2010, 04:21AM
Registered Member #51876
Joined: Jun 27 2009, 05:14AM
Location: Murcia-Spain
Posts: 106
I am create a plugin. Is a page. I have this error

the error is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Users\jose\Desktop\ZMWS\_web.zmwsc\e107\pagina.php on line 26


in this page (pagina.php) The file is in e_BASE

********************************************

line 10 = require_once("e107_config.php");
line 11 = define("SERVIDOR", $mySQLserver);
line 12 = define("USUARIO", $mySQLuser);
line 13 = define("CONTRASEÑA", $mySQLpassword);
line 14 = define("BASEDEDATOS", $mySQLdefaultbd);
line 15 = define("PREFIJOBD", $mySQLprefix);

line 17 = $CONEXION=mysql_connect("".SERVIDOR."","".USUARIO."","".CONTRASEÑA."");
line 18 = $BD="".BASEDEDATOS."";
line 19 = $SQL_PAGINA="select * from ".PREFIJOBD."articulo order by id_articulo desc";

line 21 = $RES_PAGINA=mysql_db_query($BD,$SQL_PAGINA,$CONEXION);

line 26 = while ($REG_PAGINA=mysql_fetch_array($RES_PAGINA)) // Here is the bug
line 27 = {
line 28 = echo $REG_PAGINA["titulo_articulo"];
line 29 = }

*******************************************
Go to top
Website
nlstart
Jul 26 2010, 04:38AM
nlstart
  • e107 Site administrator
  • e107 Core developer
  • e107 Translation Team Leader
Registered Member #29855
Joined: Aug 18 2006, 01:12AM
Location: Utrecht, The Netherlands
Posts: 5493
I doubt if the define name CONTRASEÑA is valid. Avoid special characters and hyphens (-) in define names. Underscores (_) in define names are okay.
Go to top
Website
josicoesp
Jul 26 2010, 04:44AM
Registered Member #51876
Joined: Jun 27 2009, 05:14AM
Location: Murcia-Spain
Posts: 106
Hi nlstart.

I change the CONTRASEÑA by PASS and the problem persist.

I think that the error is in the line 26 but I don´t know that is.
[ Edited Jul 26 2010, 04:45AM ]
Go to top
Website
nlstart
Jul 26 2010, 07:08AM
nlstart
  • e107 Site administrator
  • e107 Core developer
  • e107 Translation Team Leader
Registered Member #29855
Joined: Aug 18 2006, 01:12AM
Location: Utrecht, The Netherlands
Posts: 5493
Please also see the correct syntax: [-link-]
Go to top
Website
josicoesp
Jul 26 2010, 08:47AM
Registered Member #51876
Joined: Jun 27 2009, 05:14AM
Location: Murcia-Spain
Posts: 106
¡¡¡¡AAAARRRRGGGG!!!!

¡¡¡Look my error!!!

line 14 = define("BASEDEDATOS", $mySQLdefaultbd);

Here: $mySQLdefaultbd

In English is "db" (data base) in Spanish is bd. (base de datos)

¡¡¡¡five hours wihtout see the problem!!!!
Go to top
Website
C6Dave
Jul 26 2010, 11:20AM
  • e107 Site administrator
  • e107 Support Team Leader
Registered Member #9506
Joined: Jul 31 2004, 12:57AM
Location: North East UK
Posts: 12343
The simplest errors are often the hardest to find
Go to top
Website
septor
Jul 26 2010, 02:00PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #37
Joined: Aug 11 2002, 03:20AM
Location: United States
Posts: 2660
Also the hardest to cope with when you eventually find them.
Go to top
Website
nlstart
Jul 26 2010, 11:05PM
nlstart
  • e107 Site administrator
  • e107 Core developer
  • e107 Translation Team Leader
Registered Member #29855
Joined: Aug 18 2006, 01:12AM
Location: Utrecht, The Netherlands
Posts: 5493
You could also do this much shorter in e107.

<?php
require_once('class2.php');
$mysql = new db();
$mysql->db_SelectGen("SELECT * FROM #articulo ORDER BY id_articulo DESC");
while($row = $mysql->db_Fetch())
{
echo $row["titulo_articulo"];
}
?>
Go to top
Website
josicoesp
Jul 27 2010, 05:04PM
Registered Member #51876
Joined: Jun 27 2009, 05:14AM
Location: Murcia-Spain
Posts: 106
Where I can learn more about the php code for e107?
Go to top
Website
septor
Jul 27 2010, 08:18PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #37
Joined: Aug 11 2002, 03:20AM
Location: United States
Posts: 2660
Go to top
Website
nlstart
Jul 27 2010, 11:37PM
nlstart
  • e107 Site administrator
  • e107 Core developer
  • e107 Translation Team Leader
Registered Member #29855
Joined: Aug 18 2006, 01:12AM
Location: Utrecht, The Netherlands
Posts: 5493
To be more precise: [-link-]
See [-link-] for starters.
Go to top
Website
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System