Jump to content

Search the Community

Showing results for tags 'reg'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Good morning, I have a script and I'm trying to check whether it contains 1 character and whether it is between A and Z. preg_match() seems to be returning 0 and I'm not sure why. Here is my code: <?php $conn = mysqli_connect("localhost","root","","gaming") or die("Error: ".mysqli_error()); $qry = "SELECT game_id, release_date, game_desc, game_icon FROM games"; if(isset($_GET['letter'])) { /*if(strlen($_GET['letter']) == 1) { } else { header("Location: ?page=games"); }*/ $match = preg_match("/A-Z/", $_GET['letter']); echo $match; $qry .= " WHERE game_tag = '{$_GET['letter']}'"; } $sql = mysqli_query($conn, $qry) or die("Error: ".mysqli_error($conn)); $game_output = ""; while($row = mysqli_fetch_assoc($sql)) { $game_output .= "<div class='game_containers'>"; $game_output .= "<img src='images/game_icons/{$row['game_icon']}' alt='{$row['game_id']}' class='game_icon' />"; $game_output .= "<h3 class='game_header'>{$row['game_id']}</h3>"; $game_output .= "<p class='game_desc'>{$row['game_desc']}</p>"; $game_output .= "<hr />"; $game_output .= "Release Date: <span class='game_date'>{$row['release_date']}</span>"; $game_output .= "</div>"; } mysqli_close($conn); ?> When I echo $match, it always returns 0 even though $_GET['letter'] contains say 'M' or 'C' Any thoughts? Kind regards, L2c.
×
×
  • 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.