Jump to content

Recommended Posts

Hi.. I´m having some problem with variables..

I´m working on a calendar that gets info from a database everytime a day or month is clicked... It´s a downloaded code. So the code declares this variables.. (among others.. I just put here the ones I´m trying to work with)..

 

$param_d[\'link_on_day\'] = $PHP_SELF.\'?date=\';

 

$current_day = date(\"d\", $timestamp);

$current_month = date(\'n\', $timestamp);

$current_month_2 = date(\'m\', $timestamp);

$current_year = date(\'Y\', $timestamp);

 

Later on the script it makes the link with those variables for each day.

 

<A=\"\'.$param \'link_on_day\'].$current_year.$current_month_2.$i_2.\'\">\'.$i.\'</A>

 

 

Now I get a link that is something like this:

 

/calend?date=20030508

 

¿How can I use these to grab the rows I need from the DB... ?

 

I´ve tried something like this with all the variables.. but It doesn´t work

 

@mysql_select_db($database) or die( \"No hay base de datos\");

$query=\"SELECT * FROM agenda WHERE mes=\'.$current_month\'\";

$result=mysql_query($query);

 

I don´t why it doesn´t read the variables.. I´ve tried using echo to see if it´s getting the value.. but it isn´t..

I know is probably a stupid thing.. but I can´t figure it out..

And yes I´m reading the Manual and I´m getting a book next week, but until then I won´t sleep well..

Thanx..

Link to comment
https://forums.phpfreaks.com/topic/229-variable-problem/
Share on other sites

Sorry, I wrote the link wrong. The whole line is like this

 

$output .= \'<TD class="calendarDays\'.$param[\'calendar_id\'].\'"><A href="\'.$param[\'link_on_day\'].$current_year.$current_month_2.$i_2.\'">\'.$i.\'</A></TD>\'."n";

 

And the

/calend?date=20030508

Is just the path that the browser shows for each day (obviously the numbers change for each day).

 

And sorry again, I´m EL Nuevo, so I still don´t get how can I use this variables to get the stuff to show from my table. I keep getting a Mysql error telling me that supplied argument is not valid when cheking for num_rows, so I assume that the variable $current_whatever is not valid so the num_rows result is 0.

I´ve tried just echoeing or printing the value of $current_whatever to see if it´s getting any.. but it is not..

Any clues?

Link to comment
https://forums.phpfreaks.com/topic/229-variable-problem/#findComment-680
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.