Jump to content

Recommended Posts

Hi guys,

 

I'm creating a patchbook type thing where users post their settings for instruments for a music creation program called 'Little Sound DJ' (LSDJ for short).

I've literally been doing PHP and mySQL for two days and I've learnt a lot already but I'm kinda stuck now.

 

Already I've implemented a punBB user system which stores the user who created the patch and hides the Submit button to stop guests posting patches and flooding the database. I've also got the whole thing writing and calling data to my database.

 

What I need help with is filtering between and displaying patches. There are 4 types of patches, all with different data which can be entered into them:

 

PULSE - WAVE - KIT - NOISE

 

All of these are being stored in the same table like so:

pulse_name

pulse_ etc..

wave_name

wave_ etc...

kit_name

kit_ etc...

noise_name

noise_ etc...

The table also has an id row and a username row, storing the name of the punBB user.

 

So if I show a table full of results for a PULSE patch like so:

(It's not pretty, but I'll style it once I've got the back code done)

<table align="center" width="228" border="1" cellspacing="0">
  <tr>
    <td width="49"><? echo $rows['usrname']; ?></td>
    <td width="175"><? echo $rows['type']; ?></td>
  </tr> 
  <tr>
    <td>Name:</td>
    <td><? echo $rows['pulse_name']; ?></td>
  </tr>
  <tr>
    <td>Envelope:</td>
    <td><? echo $rows['pulse_envelope']; ?></td>
  </tr>
  <tr>
    <td>Wave:</td>
    <td><? echo $rows['pulse_wave']; ?></td>
  </tr>
  <tr>
    <td>Output:</td>
    <td><? echo $rows['pulse_output']; ?></td>
  </tr>
  <tr>
    <td>Length:</td>
    <td><? echo $rows['pulse_length']; ?></td>
  </tr>
  <tr>
    <td>Sweep</td>
    <td><? echo $rows['pulse_sweep']; ?></td>
  </tr>
  <tr>
    <td>Vib. Type</td>
    <td><? echo $rows['pulse_vibtype']; ?></td>
  </tr>
  <tr>
    <td>PU2 Tune</td>
    <td><? echo $rows['pulse_pu2tune']; ?></td>
  </tr>
  <tr>
    <td>PU Fine</td>
    <td><? echo $rows['pulse_pufine']; ?></td>
  </tr>
  <tr>
    <td>Automate</td>
    <td><? if($rows['pulse_auto'] == ''):
    		echo 'Off';
    		else:
    		echo 'On';
    		endif; ?></td>
  </tr>
  <tr>
    <td>Table</td>
    <td><? if($rows['pulse_table'] == ''):
    		echo 'Off';
    		else:
    		echo 'On';
    		endif; ?></td>
  </tr>
  </table>

How can I tell the PHP/mySQL to display a patch separately in a different table if the type (PULSE,WAVE,KIT,NOISE) is different?

 

I am literally just calling the data from the database like so:

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect server "); 
mysql_select_db("$db_name")or die("cannot select DB");


$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
?>

My server details:

 

MySQL client version: 5.0.32

Used PHP extensions: mysqli

 

If you need more info please ask, I'd really like to get this solved soon!

 

Thanks,

2xAA :)

 

id
usrname
type

pulse_name
pulse_envelope
pulse_wave
pulse_output
pulse_length
pulse_sweep
pulse_vibtype
pulse_pu2tune
pulse_pufine
pulse_auto
pulse_table

wave_name
wave_volume
wave_output
wave_vibtype
wave_play	
wave_length
wave_repeat
wave_speed
wave_auto
wave_table
wave_wave
wave_filter
wave_q
wave_dist
wave_phase
wave_svol
wave_scutoff
wave_sphase
wave_svshift
wave_evol	
wave_ecutoff
wave_ephase
wave_evshift

kit_name
kit_kit1
kit_kit2
kit_volume
kit_output	
kit_pitch
kit_offset1
kit_offset2
kit_len1
kit_len2
kit_loop1
kit_loop2
kit_speed
kit_dist
kit_vibtype
kit_auto
kit_table

noise_name
noise_output
noise_length
noise_shape
noise_scmd
noise_auto
noise_table

 

the _auto and _table for each type are checkboxes.

To display these I'm using an 'if' function to say if they are on or off.

 

Thanks for the help by the way :)

Thank-you fenway :)

 

Would you like any credit (ie a link to your profile here?/website is you have one?) on the bottom of the front page when it is finished? (This site should generate a fair amount of traffic)

If not you can 'solve'/delete this thread.

 

Thanks once again!

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.