Jump to content

Gaoshan

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Gaoshan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. OK, thanks guys. I'll fix their relations as the tables do need to be reconfigured in a few places. Especially since they really aren't truly, totally, unrelated. Much appreciated.
  2. I have a few questions before I can help you out. 1. What is an example of a specific value for $mailstamp? 2. Why do you use $now = date("j, m, Y - H:i.s", strtotime("now")); rather than something simpler like $now = time(); ? You don't need the double quotes around your variables. You have: if( $now < "$MailStamp" ) just use: f( $now < $MailStamp ). You have if Mailimit, elseif Mailtime and then nothing. You need to return some sort of value at the end in case the previous if statements are not met. Last, you start off with if isset, elseif isset. Try a simpler: [code]if(!isset($_POST[username]) || !isset($_POST[msg])) { echo "missing"; return false; }[/code]
  3. [code]mysql_query("INSERT INTO thetable (thecolumn) values ($_POST['foo'])");[/code] Of course, this assumes you are getting the login data via $_POST.
  4. [url=http://www.intranetjournal.com/php-cms/]http://www.intranetjournal.com/php-cms/[/url] [url=http://www.adobe.com/devnet/dreamweaver/articles/php_blog1.html]http://www.adobe.com/devnet/dreamweaver/articles/php_blog1.html[/url] These will both get you started. Note that the second one uses Dreamweaver and kind of ends at a point where you would need to purchase a commercial product to continue with their tutorial. That said you can still glean some useful beginner info from it. Also, these are very basic "applications" you will build. Don't rely on this for anything serious or important as they need much better security, more options and the ability to handle unexpected results or input.
  5. I didn't think I needed to use a JOIN here. I am using the data separately in two unrelated areas. Do I need a JOIN anyway? The grades table is as such: [code]-- -- Table structure for table `grades` -- CREATE TABLE `grades` (   `id` smallint(6) NOT NULL auto_increment,   `studentid` smallint(6) NOT NULL,   `assignmentid` smallint(6) NOT NULL,   `earned` decimal(3,1) NOT NULL,   `comment` text NOT NULL,   PRIMARY KEY  (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; [/code] The sort of data I'm inserting: [code]INSERT INTO `grades` VALUES (7, 1, 1, 9.0, 'Nice solution to a difficult...etc. etc.'); [/code] @fenway: Why would the query return so many results? I thought that that query would get me the sum of the one column and the average of the other and they would be unrelated to to each other. Where is the connection between them that is causing the problem?
  6. You need to first create a user named pma, define it in config.inc.php (controluser/controlpass) and then run the file: create_tables_mysql_4_1_2+.sql (assuming your version of MySQL is 4.1.2 or higher, of course) It is in the phpmyadmin scripts folder. That should take care of your problem.
  7. This code (the one you last posted which now has the correct number of brackets) should work fine assuming you have the values for your various variables properly defined somewhere and assuming you put something in the currently empty if...else statement. I tested it (cut and past and then changed variables and selects to match my setup) and it returned data no problem.
  8. looks like: "Failed to connect to 72.246.73.242: Host is down" To see this yourself try adding: [code]if (curl_errno($ch)) {   print curl_error($ch); } else {   curl_close($ch); }[/code]
  9. It is the last " causing you trouble (the one right before the closing parenthesis). Lose it and you should be ok. Just curious but why use print_r for this? I think a faster solution would be something like: [code]echo '<tr><td><p><img src="../art/' . $myrow[photoname] . '"></p></td></tr>';[/code]
  10. You are missing a closing bracket. The if statement is never closed in the code you posted.
  11. For 1: Create a basic template that can draw the data it needs (or in the case of files it can draw on the location of the files), based on userid and password, from your database and populate it. Do this rather than creating a directory for each user. For 2: Not unless you take pains to enforce unique IDs. To link various profiles you could, as one of many possible ways, pass variables to your profile page using GET  as part of a link [code]<a href="profile.php?id=' . $theid . '">[/code]and have the database use the GET info to pull data for the page.[code]SELECT * FROM users WHERE userid = $theid[/code]
  12. By "jump pass the form" do you mean you want the form to load some other page and it doesn't or do you want the form to reload the same page and it doesn't? Not clear what you want to do.  ???
  13. [code]<?php $result = mysql_query('SELECT * WHERE 1=1'); if (!$result) {     die('Invalid query: ' . mysql_error()); } ?>[/code]
  14. I get 2 different results from a query that I thought would return the same result. The reason I want to use the first example (which returns an incorrect value for SUM) is that I also need the AVG value and don't want to make 2 queries if at all possible. If I set up my query this way, I get an incorrect result (with maxgrade = 630): [code]SELECT SUM(a.maxgradepoints) AS maxgrade, AVG(g.earned) AS avgrade FROM assignmentdata a, grades g[/code] If I set it up this way, I get a correct result with (maxgrade = 30): [code]SELECT SUM(maxgradepoints) AS maxgrade FROM assignmentdata[/code] My table looks like this: [code]TABLE `assignmentdata` (   `id` smallint(6) NOT NULL auto_increment,   `assignmentnum` tinyint(20) NOT NULL,   `assignmentname` varchar(100) NOT NULL,   `maxgradepoints` tinyint(100) NOT NULL,   PRIMARY KEY  (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `assignmentdata` -- INSERT INTO `assignmentdata` VALUES (1, 1, 'Photograph Something Meaningful', 10); INSERT INTO `assignmentdata` VALUES (2, 2, 'Portraits (1 straight, 1 environmental)', 10); INSERT INTO `assignmentdata` VALUES (3, 3, 'Sports (Action)', 10);[/code] I'm using MySQL 5.0.18.
×
×
  • 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.