Jump to content

benanamen

Members
  • Posts

    2,034
  • Joined

  • Last visited

  • Days Won

    38

benanamen last won the day on December 15 2020

benanamen had the most liked content!

1 Follower

Contact Methods

  • Website URL
    http://galaxyinternet.us/
  • Yahoo
    phpfreaks@galaxyinternet.us

Profile Information

  • Gender
    Not Telling
  • Interests
    Email me at phpfreaks@galaxyinternet.us

Recent Profile Visitors

7,603 profile views

benanamen's Achievements

Prolific Member

Prolific Member (5/5)

131

Reputation

41

Community Answers

  1. Two things. You need to upgrade your PHP to a current version. Second thing, mysql_* has been completely removed from PHP. I would suggest you use PDO with Prepared Statements. https://phpdelusions.net/pdo
  2. I am not suggesting you go to a Framework although they are structured the way I mentioned. Check out this free Laracast video series on PHP. It is the only video tutorial I have seen that I would recommend to anyone. It will get you going in the right direction. Watch each one even if you understand it already. The PHP Practitioner https://laracasts.com/series/php-for-beginners
  3. The "real" problem is that you have no Architecture to your site. Having a direct correlation of URLS to file paths is a very restrictive and low level design. By designing using a "Front Controller" or "MVC" pattern with a single point of entry you could move files anywhere you want without affecting the URLS. Optimally, all your files should be above the root save for the index.php and your assets such as images, JS and CSS. It may be above your current skill level but it is well worth learning.
  4. After re-reading this thread it seems apparent that what you really need is a BI (Business Intelligence) tool that is purpose built for the real problem you are trying to solve, generating various reports. Tableau and Power BI are such tools. (There are many others). I am going to bow out of your specific request since I think you are going about it wrong and are not willing to do anything beyond "how" you are trying to solve a problem.
  5. Since you are insisting on doing things they way you are, here is working code. <?php $host = '127.0.0.1'; $db = 'test'; $user = 'root'; $pass = ''; $charset = 'utf8mb4'; $dsn = "mysql:host=$host;dbname=$db;charset=$charset"; $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]; try { $pdo = new PDO($dsn, $user, $pass, $options); } catch (\PDOException $e) { throw new \PDOException($e->getMessage(), (int)$e->getCode()); } $sql = 'DROP PROCEDURE IF EXISTS test1'; $pdo->exec($sql); $sql ='CREATE PROCEDURE test1(IN LastID INT(5)) BEGIN SELECT person.RecordID AS PersonID, organization.Name FROM person INNER JOIN organization ON person.lnk_organization = organization.RecordID LIMIT 10; SELECT person.RecordID AS PersonID, organization.Name, organization.City, organization.State, organization.Zip FROM person INNER JOIN organization ON person.lnk_organization = organization.RecordID LIMIT 25; END'; $pdo->exec($sql);
  6. You will get a lot farther if you give us a high level overview of what you have going on rather than how you want to do it. "The users can create tables" is a very bad smell. Something is not right. What we currently have here is know as an XY Problem. https://xyproblem.info/
  7. It's hardly purist. It is basic Database Normalization. What are you going to do if there are more image caps, keep adding columns? +2 to the ADDITIONAL bad DB design. How is the OP supposed to learn when a forum expert shows them the wrong way.
  8. Surprised at you @Barand. There should be a separate table for the image caps keyed to the image url id not consecutive numbered columns. I know you know that.
  9. I mean dump the $data variable. There is nothing there to loop over. var_dump($data);
  10. Additionally, you need to access the file through a server, not the filesystem. If your URL starts like file:/// you are not using a server.
  11. It should be noted that trimming $_POST with array_map as shown will fail on multi-dimensional arrays. A simple function will solve the problem. function trim_array($input) { if (!is_array($input)) { return trim($input); } return array_map('trim_array', $input); } $_POST = [ ["data1 ", " data2", " data3 "], ["data4", " data5", " data6 "]]; $post = trim_array($_POST); var_dump($post);
  12. Any decent editor or IDE will do it for you.
  13. mysql_* has been completely removed from current versions of Php. You need to use PDO with Prepared statements. This tutorial will get you going. https://phpdelusions.net/pdo
  14. I knew this conversation sounded familiar......... https://www.phphelp.com/t/terminology-discourse/33277/5
×
×
  • 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.