Jump to content

haven't slept for 14hours, can u help with code?


l4cky

Recommended Posts

:'(

Hi!! I have big problems and I am pretty new to php and mysql.

Here's what I want to do.

 

I have 3 databases (mysql):

DB 1 info: Paddler ID, first name, last name, as Paddler ID primary key

DB 2 exercise: Exercise ID, Paddler ID, Practice ID, Push-up, Abs

DB 3 practicedate: Practice ID, Date

 

Now what I want to do 2 things:

 

1) Print a table for each paddler as titled "first name, last name" where rows = Push ups & abs ; columns are Dates

 

2) Print a table for each exercice (as titled "push ups" and "abs") where rows = first name and last name ; columns are Dates

 

I want to get it autmaticly printed if for each paddler ID found on DB2, so if a paddler is added, there will be less trouble. I have i have to use some array, but I don't really know.. also I think I need to link databases too :(

 

It's hard for me to accomplish it because I am new, any help? :shy:

 

Haven't slep a while because of that :(

:'(

Hi!! I have big problems and I am pretty new to php and mysql.

Here's what I want to do.

 

I have 3 databases (mysql):

DB 1 info: Paddler ID, first name, last name, as Paddler ID primary key

DB 2 exercise: Exercise ID, Paddler ID, Practice ID, Push-up, Abs

DB 3 practicedate: Practice ID, Date

 

Now what I want to do 2 things:

 

1) Print a table for each paddler as titled "first name, last name" where rows = Push ups & abs ; columns are Dates

 

2) Print a table for each exercice (as titled "push ups" and "abs") where rows = first name and last name ; columns are Dates

 

I want to get it autmaticly printed if for each paddler ID found on DB2, so if a paddler is added, there will be less trouble. I have i have to use some array, but I don't really know.. also I think I need to link databases too :(

 

It's hard for me to accomplish it because I am new, any help? :shy:

 

Haven't slep a while because of that :(

 

14 hours of not sleeping is a lot? Seems to be the average imo...  :P

 

Anyway, just to clear things up, do you have any code you can provide for us to start with?

 

Also, are they 3 different databases, or tables within a database? If it's the former, are you restricted to switching it to the latter?

:'(

Hi!! I have big problems and I am pretty new to php and mysql.

Here's what I want to do.

 

I have 3 databases (mysql):

DB 1 info: Paddler ID, first name, last name, as Paddler ID primary key

DB 2 exercise: Exercise ID, Paddler ID, Practice ID, Push-up, Abs

DB 3 practicedate: Practice ID, Date

 

Now what I want to do 2 things:

 

1) Print a table for each paddler as titled "first name, last name" where rows = Push ups & abs ; columns are Dates

 

2) Print a table for each exercice (as titled "push ups" and "abs") where rows = first name and last name ; columns are Dates

 

I want to get it autmaticly printed if for each paddler ID found on DB2, so if a paddler is added, there will be less trouble. I have i have to use some array, but I don't really know.. also I think I need to link databases too :(

 

It's hard for me to accomplish it because I am new, any help? :shy:

 

Haven't slep a while because of that :(

 

14 hours of not sleeping is a lot? Seems to be the average imo...  :P

 

Anyway, just to clear things up, do you have any code you can provide for us to start with?

 

Also, are they 3 different databases, or tables within a database? If it's the former, are you restricted to switching it to the latter?

 

You're right, 3 tables my bad!!

I haven't started anything working, garbage them delete them, cuz I can't think of something, don'T know where to start lol I am still working on it. Actually havent slept for 14 days, but had been working on it for 2-3 days. But the biggest problem is like I want to speak German while I can only use google translate (my newbness to php).

 

What does " restricted to switching it to the latter?" stands for?

:confused: :confused: :confused: :confused:

:'(

I wanna give up!! i am so confused , can anyone help? i tried that and can't even write the correct syntax sigh, can anyone takes a llook of that?

 

i want to make an array of tables...

 

<?
include("../sql.php");
$r = mysql_query("SELECT * FROM paddlerinfo t1 LEFT JOIN pushup t2 on t2.paddler_id=t1.id LEFT JOIN practicedate t3 on t3.practice=t2.practice_id ORDER BY t1.firstname ASC ");


while ($row = mysql_fetch_array($r)) {
if (t2.paddler_id=t1.id [sup]EXISTS AND PRINT THE ID ONLY ONCE[/sup]){
echo $row['firstname'];
echo "<br>";
echo "<table border='1' cellpadding='0' cellspacing='0' style='font-family: monospace'> <tr>";
echo "<td> date </td>";

$result = mysql_query("EXPLAIN pushup");
while ($row = mysql_fetch_assoc($result)) {
if (in_array($row["Field"], array("paddler_id", "practice_id", "p_id"))) continue;
echo "<td>", htmlentities($row["Field"]), "</td>" ; /[sup]/THIS IS SUPPOSED TO PRINT ALL COLUMN TITLE AS THE T3 COLUMNS[/sup]
}

echo [sup]VALUES OF PRACTICEDATE T3 AND VALUES OF EXERCICES FROM T3 COLUMNS[/sup];

echo "</tr> </table>";

mysql_free_result($r);
mysql_free_result($result);
mysql_close();
?>

 

:(

can you write exactly how you want it to look when you open the webpage?

 

Thanks for replying!

 

My target is:

 

Once page opens

 

it list all paddlers name (only those id who existed has stats into the pushuptable) using <li><a href="#paddlerfirstname">paddlerfirstname</a>

 

Then Make a table name titled as "first paddler name"

 

Then the table where columns = different type of push ups (which are the fields of table pushup except 3 fields (p_id, paddler_id, practice_id) and where rows are the dates of practices (which is a field of table 3 practicedate)

so to clarify:

 

All Paddler First Name List Here


Paddler First Name

--------------------------------------------
| pushup 1 | pushup 2 | pushup 3 | pushup 4|
--------------------------------------------
| date 1    | date 2    | date 3     | date 4    |
--------------------------------------------

 

is that right?

so to clarify:

 

All Paddler First Name List Here


Paddler First Name

--------------------------------------------
| pushup 1 | pushup 2 | pushup 3 | pushup 4|
--------------------------------------------
| date 1    | date 2    | date 3     | date 4    |
--------------------------------------------

 

is that right?

 

More like this :

 

--------------------------------------------

                | pushup 1 | pushup 2 | pushup 3 | pushup 4|

--------------------------------------------

| date 1    | value1 | value 2 | value3 | value 4|

--------------------------------------------

| date 2    | value1 | value 2 | value3 | value 4|

--------------------------------------------

 

Thanks!!

 

so what is date 1 and date 2 in the database? is it the practicedate table column DATE? if so then what is value 1 and value 2 in the database?

hey!

yes it is the practice table column DATE.

Value 1 and 2 and etc.. are # of pushups of table pushup

 

So basicly the tables in the DB are

 

Table paddlerinfo

 

id

firstname

 

Table pushup

paddler_id

practice_number

wide_push_ups

normal_push_ups

miliraty_push_ups

 

table practicedate

practice_id

date

 

and join table 2 and 1 where paddler_id table 2 = id table 1 ; join table 3 and 2 where practice_number table 2 = practice_id table 3

 

 

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.