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 :(

Link to comment
Share on other sites

:'(

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?

Link to comment
Share on other sites

:'(

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?

Link to comment
Share on other sites

: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();
?>

 

:(

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!!

 

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

  • 2 weeks later...
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.