database inittialization for a plugin
-
hello folks, i am almost new to the vast PHP programming world , and i have some concepts that i misundestand…
here is my code
<?php recojerfechas(); $action = checkGet('action',''); switch($action) { case "pintarfechas": recojerfechas(); break; } function recojerfechas () { global $wpdb; $table_name = $wpdb -> prefix ."temporada" ; $query = "SELECT * FROM $table_name;"; $result = $wpdb -> query($query); while ($datostemporada = mysql_fetch_row($result)) { $idfila = $datostemporada[0]; global $wpdb; $table_name = $wpdb -> prefix ."tarifas"; $sql= " SELECT * FROM $table_name WHERE id_tarifa = $datostemporada[4]"; $resulta = mysql_query($sql); $datostarifaaplicada = mysql_fetch_row($resulta); echo "[$datostemporada[2],$datostemporada[3],$datostarifaaplicada[3]]"; } } ?>and this are my errors
Notice: Trying to get property of non-object in /usr/local/pem/vhosts/118777/webspace/httpdocs/wp-content/plugins/reservations/pintor_de_rangos.php on line 16 Fatal error: Call to a member function query() on a non-object in /usr/local/pem/vhosts/118777/webspace/httpdocs/wp-content/plugins/reservations/pintor_de_rangos.php on line 18Yes, i am calling this file directly from my Navigator… .You all might say that — What is doing a guy that doesnt know how to instanciate an object , making a plugin ? well i am trying to learn….
What a heck is an object , why at my main plugin page works and not here…. i wanted to create more than one page, please dont refer me to the codex i come from there , i even copy pasted examples but i always get the same error , it seems i need another file (include something) or that i need to instaciate an object , which honestly i dont know what it means…
Thanks for reading till here.
The topic ‘database inittialization for a plugin’ is closed to new replies.