
gaza165
Members-
Posts
472 -
Joined
-
Last visited
Never
Everything posted by gaza165
-
I dont think you understand what i want Using the code ive got it outputs like this.... <div class='sport'> <h1>B</h1> <p>Badminton</p> </div> <div class='sport'> <p>Basketball</p> </div> This is wrong, i want it to output like this <div class="sport"> <h1>B</h1> <p>Badminton</p> <p>Basketball</p> </div> <div class="sport"> <h1>C</h1> <p>Cricket</p> </div> You can see that basketball is in the same div here. This is what i want..
-
?????? dont understand ???? I dont want to add a break i want to wrap all the B's...then wrap all the C's then wrap all the D's etc
-
The code below I have does exactly what i want to do.. B Badminton Basketball Bowles C Cricket <div class="sport-wrapper"> <?php include("./dbconnect/dbconnect.php"); $sql = mysql_query("SELECT sport_name,sport_image FROM all_sports ORDER BY sport_name"); $prev = ''; while ($row = mysql_fetch_row($sql) ) { echo "<div class='sport'>"; $game = $row[0]; $initial = $game{0}; if ($prev != $initial) { echo "<h1>$initial</h1>"; $prev = $initial; } echo "<p>".$game."</p>"; echo "</div>"; } ?> </div> However i want it to come out like so <div class="sport"> <h1>B</h1> <p>Badminton</p> <p>Basketball</p> </div> <div class="sport"> <h1>C</h1> <p>Cricket</p> </div> However this is the way it comes out <div class='sport'><h1>B</h1><p>Badminton</p></div> <div class='sport'><p>Basketball</p></div> Even though basketball is in the B Basically i want a div to wrap around all B's... all C's etc...
-
How do i do that??
-
I tried SELECT DISTINCT UPPER(LEFT(sport_name,1)) as letters, sport_name FROM all_sports ORDER BY letters, sport_name But it comes out with duplicate alphabet letters... * B Badminton * B Basketball * C Cricket * F Football * N Netball * S Squash * T Table Tennis * T Tennis * V Volleyball
-
Hi im trying to write a query that outputs the following. Say I have a list of sports such as: Football Badminton Basketball Cricket Squash I want to write a query that outputs it like the following... B Badminton Basketball C Cricket F Football S Squash So the names of the sport including their corrosponding letter. this is what i have so far <div class="sport-wrapper"> <?php include("./dbconnect/dbconnect.php"); $id = $_GET['id']; $sql = mysql_query("SELECT (DISTINCT UPPER(LEFT(sport_name,1)) as letters) FROM all_sports ORDER BY letters") or die(mysql_error()); echo "<ul class='sports'>"; while($row = mysql_fetch_array($sql)) { ?> <li> <span><?php echo $row['letters'];?></span> </li> <?php } ?> </ul> </div>
-
Thanks Mchl Do you think I should investigate MVC frameworks to learn OOP. I have just bought the book PHP,Objects, Patterns and Practices... is this a good book to have bought?? Shall i look into MVC?? What about the Zend Framework? Thanks Garry
-
Sorry... I did take what Mchl said and have taken his advice... sorry for not providing any recognition.. :-\ In terms of my class variables, I was under the impression that any variables that use inside the class should be declared at the beginning?? Are you saying that none of the variables I am using are needed to be defined, I can just use normal variables without declaring them? Thanks for everyones input. Garry
-
Sorry... my questions is Ive only started OOP, from what you can see from the code, is there anywhere I have gone wrong or need to change?? Cheers
-
<?php include("database.php"); class Blog extends DBConnect { private $row; public $title; public $body; public $id; function __construct() { include("bbcode/nbbc.php"); include("bbcode/bbcode_rules.php"); $this->connect(); } function printBlogByTitle($title) { $this->title = str_replace("-"," ",$title); $this->query("SELECT * FROM blog WHERE blog_title = '$this->title'"); while($this->row = $this->fetch()) { echo $this->row['blog_title']; echo $this->bbcode->Parse($this->row['home_body']); $this->GetComments(); } } function getBlogIDByTitle() { $this->query("SELECT blog_id FROM blog WHERE blog_title = '$this->title'"); $this->row = $this->fetch(); return $this->row['blog_id']; } function GetComments() { $this->id = $this->getBlogIDByTitle(); $this->query("SELECT * FROM blog_comments WHERE `blog_id` = $this->id; "); echo "<div class='blogwrapper'>"; while($this->row = $this->fetch()) { echo "<h1 class='title'><a href='/".str_replace(" ","-",$this->row['name'])."/'>".$this->row['name']."</a></h1>"; } echo "</div>"; } function printAllBlogs() { $this->query("SELECT * FROM blog"); echo "<div class='blogwrapper'>"; while($this->row = $this->fetch()) { echo "<h1 class='title'><a href='/".str_replace(" ","-",$this->row['blog_title'])."/'>".$this->row['blog_title']."</a></h1>"; echo "<div class='posted'>"; echo "<span>Posted By <b>".$this->row['posted_by']."</b> on<b> ".date('l jS \of F Y h:i:s A',strtotime($this->row['blog_created']))."</b></span>"; echo "</div>"; echo $this->bbcode->Parse($this->row['home_body']); } echo "</div>"; } } ?>
-
I am doing OOP Programming for my website.... I have created a class called 'Blog' im wondering if it is a better idea, for the comments to create a new COmment class that extends blog to bring back the comments to the related blog or just haev the function inside the Blog class.
-
Hey Everyone, Im just on the first stages of developing a new website for the local council. Please let me know what you think and where ive gone wrong. http://twells.thedesignmonkeys.co.uk thanks very much. Garry
-
Hi Guys, Can you please critique my website? http://twells.thedesignmonkeys.co.uk/index.html Let me know what you think of the design, is the layout and overall asthetics of the site ok?? Thanks Garry
-
Below I have my Blog Class that controls everything to do with my blog. I want to be able to parse the `home_body` using the NBBC Code Parser. However, when I try to run the Parse method on my `home_body` row, I get this error! Call to a member function Parse() on a non-object Can anyone help me and tell me what I am doing wrong? <?php include("nbbc.php"); $bbcode = new BBCode; class Blog { private $dbLink; var $title, $home_body, $main_body, $blog_created, $posted_by, $blog_thumb; function __construct() { $this->dbLink = mysql_connect('localhost', 'root', ''); mysql_select_db('test'); } function Retrieve_Blogs() { $this->dbLink = mysql_query("SELECT * FROM `blog` ORDER BY `blog_created` DESC"); while($row = mysql_fetch_array($this->dbLink)) { echo $bbcode->Parse($row['home_body']); } } function Show_Blog($blog_title) { $this->dbLink = mysql_query("SELECT * FROM `blog` WHERE `blog_title` = '$blog_title'"); while($this->rows = mysql_fetch_array($this->dbLink)) { print $this->rows['blog_title']; } } } ?>
-
Is it the this page that does not show or is it once you have submitted the form?? I get a T_CONSTANT_ENCAPSED_STRING error.... This is because you have not put () around your die statements. For example <?php die "Your email address is not entered."; ?> Needs to be <?php die("Your email address is not entered."); ?> Also, you should not be using DIE to show validation to the user... it should be for your own validation. Hope this helps Garry
-
Hey Guys, Thankyou for all your opinions and ideas. They have all been very helpful. Could someone be able to printscreen the site in a large resolution for me again so I can see if the changes i have made have resolved the problems. I have also improved the validation of the form entry to display multiple errors and today am planning on working on categorising blogs by month or topic. This is an ongoing project so will keep at it. Thanks Garry
-
Hi, Was wondering if you could take a look at my revampped site and offer some critique on appearance and functionality. http://www.thedesignmonkeys.co.uk Thanks Garry
-
Can anyone point me in the right direction on how to do that?? I need a loop to keep the connection open to look for new messages???
-
What about ZendMail??
-
it appears you havent closed your <table> with </table> i am basing this on the screenshot so i may be wrong!!
-
I am trying to formulate a script that can output strings using sockets. so far i have this code that creates and provides the user with a welcome message. <?php // don't timeout set_time_limit (0); // set some variables $host = "192.168.81.130"; $port = 3333; // create socket $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); // bind socket to port $result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n"); // start listening for connections $result = socket_listen($socket, 3) or die("Could not set up socket listener\n"); echo "Waiting for connections...\n"; // accept incoming connections // spawn another socket to handle communication $spawn = socket_accept($socket) or die("Could not accept incoming connection\n"); echo "Received connection request\n"; // write a welcome message to the client $welcome = "Roll up, roll up, to the greatest show on earth!\n? "; socket_write($spawn, $welcome, strlen ($welcome)) or die("Could not send connect string\n"); ?> i then open another file that gets the welcome message and displays it to the user. <?php $host="192.168.81.130"; $port = 3333; // open a client connection $fp = pfsockopen ($host, $port, $errno, $errstr); if (!$fp) { $result = "Error: could not open socket connection"; } else { // get the welcome message $result .= fgets ($fp, 1024); } ?> Server said: <b><? echo $result; ?></b> This works fine, however, once the script has finished the connection the to the socket server is close, how do i keep the session persistently open to keep feeding and outputting new strings?? Thanks Garry
-
Hi Everyone!! Im not very clear on mod_rewrite rules... In my index file i have a CASE/SWITCH block that controls what content displays on the homepage... I am trying to write my mod_rewrite to do the following.. If a user looks for.... http://www.domain.com/portfolio then it will do http://www.domain.com/?c=portfolio can someone please help me out??? thanks Garry
-
Hi Guys, Thankyou for your critique, I forget to mention that I am not the one designing the page, I am just putting the page together to what the specification I have been given. Do you think I should talk to the designer to change some things??? Is there anyway I can keep that middle image on the right, but when people resize their browser or have a resolution of 1024 the horizontal scroll bar wont come up, but will just overlap it?? thanks Garry
-
Hi everyone, can you critique my home page?? http://www.thedesignmonkeys.co.uk/creative Thanks Garry
-
No that bit is correct its the bit after that I only want to bring back the records that are anything to do with either user... So the user sending the message will see what they have written to another and also see the posts that are being sent to them.